Questions tagged [url-rewriting]

A URL rewrite engine is software that modifies a web URL's appearance (URL rewriting). Rewritten URLs (sometimes known as short, fancy URLs, or search engine friendly - SEF) are used to provide shorter and more relevant-looking links to web pages. The technique adds a degree of separation between the files used to generate a web page and the URL that is presented to the world.

Filter by
Sorted by
Tagged with
1
vote
0answers
9 views

How to use the same base url prefix for category and product pages in Woocommerce?

I checked out this article https://docs.woocommerce.com/document/removing-product-product-category-or-shop-from-the-urls/ which explains that it is not good to remove the product and category bases ...
2
votes
1answer
31 views

Can I rewrite to a redirected URL using .htaccess file?

I have a page A. I want to have a page B which is served as a rewrite of page A using .htaccess. Is it possible to redirect page A to page B from .htaccess or is it going to go into an endless loop?
0
votes
0answers
16 views

Does having the trailing slashes after the end of the urls affect the rank? [duplicate]

Recently I have set up trailing slashes into all my urls. I'm redirecting all the plain urls to the slash one, So I wanna know if sudden change have an affect over the Google ranking. Will Google try ...
6
votes
3answers
20k views

IIS URL Rewrite http to https EXCEPT files in a specific subfolder

I am trying to force all traffic on my web site to use HTTPS, using the URL Rewrite 2.0 module added to IIS 7.5. I got that working and now have a need to exclude a couple of pages from using SSL. So ...
1
vote
2answers
609 views

Do URL parameters create different URLs from Google's SEO perspective?

I have the following 4 URLs. Are all these the same URL or different URLs from Google's SEO perspective? (Having a different query string makes it another URL?) https://www.example.com/buy-web-...
-1
votes
1answer
17 views

Aesthetic URL problem: Website from server02 should look like its on a subdirectory of the main site from server01

www.example.com is on server01 with IP address 192.0.2.123 abc.example.com is on server02 with IP address 192.0.2.21 I actually do not want the subdomain abc. Ideally I want it at www.example.com/...
3
votes
2answers
54 views

Adding IDs to urls to open up namespace - SEO considerations?

I'm working with a site that has millions of pages along the lines of: domain.com/entity/John_Smith domain.com/entity/Google domain.com/entity/HTML One of the problems is that particularly for ...
2
votes
1answer
35 views

.htaccess - RewriteRule for 404 and query

I am very new to this stuff. I have a website with these RewriteCond/RewriteRule directives. Options All -Indexes RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}...
3
votes
1answer
1k views

Rewrite and hide page ID from URL

I am working with the following on a football website and when a user clicks an event they get the following URL format: /live/1/event-name.html Currently the number in the URL represents the ID ...
2
votes
1answer
27 views

How do I create clean URLs such that what is currently in a parameter goes in the path?

My url is http://localhost/store/product-detail.php?p=prod%name%test i want it to look like this http://localhost/store/prod-name-test or something like this as other stores do http://localhost/store/...
1
vote
2answers
73 views

Does Google index page URLs with languages parameters as a different page?

If I implement multilingual access to the resource through the parameter: 1) https://example.com/en/article-1 2) https://example.com/article-1?l=en So, does Google index both of them as a single ...
2
votes
1answer
34 views

htaccess rewriterule not working for old urls for site rebuild

I am struggling to get the rewrite rules working in .htaccess for search links on a property rental website I am working on. The old links are like this: example.com/index.php?proptype=Villa&...
1
vote
1answer
32 views

URL Character Counting - Where to start counting?

I'm rewriting URLs for a website, I know it could affect SEO, but I've no choice but to rewrite them, and 301 redirect the old ones to their new URLs. I want to try to keep the new URLs short and to ...
2
votes
1answer
76 views

How to configure .htaccess to rewrite all requests into a folder, except a list of exceptions

I have an established website with some legacy folders I would like to keep. https://example.com/.well-known/ https://example.com/Music/ https://example.com/Rutabagas/ I've also installed ...
4
votes
1answer
60 views

How would you implement redirects for domain canonicalization, no-www, and HTTPS for IIS 7.5

For the moment I'm stuck with an IIS-server, unfortunately not my best subject (I'm much better w. Apache). We have a site on a Win 2008 R2 Server with IIS 7.5. It's an old site and we are working on ...
2
votes
1answer
39 views

How to rewrite using .htacess when there is a ? (question mark) at the beginning of the URL?

Many JS functions on my site are sending Ajax request to /?something=3213214 but I need to redirect them to /something=3213214 When I do: RewriteRule ^test/(.*) /$1 [R] It does redirect /test/...
2
votes
1answer
27 views

I can't run 2 or more url rewriting rules at once

I was trying to shorten the URL more, but I was removing .php file extension from the URLs using URL rewriting too. I can't run both at the same time. Removing the extensions and trying to shorten ...
0
votes
0answers
33 views

Some links are indexable and some others are not when they are all created equal, why?

I'm trying to create a sitemap. I'm using the Screaming Frog software, but I think that this can be achieved in different ways with other software as well. My links are generated with different ...
1
vote
1answer
181 views

Using IIS URL Rewrite module instead of Global.asax for complex redirect rules

We have a legacy ASP.NET website in which complex redirect rules are coded in Global.asax. Actually this logic processes requests with several optional or variable parts like {http|https}://[www.]...
0
votes
0answers
25 views

How to redirect an URL properly using PHP taking SEO into consideration?

Explanation of the problem I want to redirect each page from a non-friendly url to a friendlier one. I've already achieved that using mod_rewrite in an .htaccess file that does send every visitor ...
2
votes
1answer
42 views

Does a new permanent rewrite rule supersede old permanent rewrite rule?

Ages ago we included a redirect in web.config to ensure that pages would rewrite to http://www.example.com/ if the user input, say, www.example.comor variants of it. Recently we changed the site so ...
2
votes
3answers
4k views

How to add a single file exception to a rewrite rule that adds a slash to wp-admin by redirecting to HTTPS?

I need to change this so that one file in wp-admin is not forced through https: # add a trailing slash to /wp-admin RewriteCond %{REQUEST_URI} ^.*/wp-admin$ RewriteRule ^(.+)$ https://%{SERVER_NAME}/$...
1
vote
1answer
137 views

How to redirect all requests to HTTPS with SEO friendly URL using Apache?

First of all, I would like to leave remove www and redirect all request to HTTPS like this: RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$...
0
votes
1answer
41 views

Rewrite rule messes up direct links to directories

I have a very simple rewrite rule which does the job: allows link domain.com/index.php?page=NAME to be displayed as domain.com/NAME. The problem is when I try to give direct link to the image www....
1
vote
1answer
83 views

Rewrite rule to give 410 Gone for a specific URL doesn't work

I'm French. A week ago, my website was hacked with the old version (http). The hack created 404 spams and I want to ensure they have "410 Gone" status. My problem on the site is: https://www.example....
0
votes
1answer
31 views

How to change the URL of a wordpress website?

By default, my URL was set to example.com/wp/wp-admin instead of the example.com/wp-admin that I used to remember. Also my website's contents show on example.com/wp rather than example.com. How do I ...
1
vote
1answer
226 views

.htaccess rewrite stops working for javascript files after moving server

We recently moved an old PHP Project from a server using httpd to our regular prod. servers running apache2. In this project we have some reroute rules that map requests either to our index.php file ...
2
votes
1answer
43 views

Do search engines crawl links with query strings?

If I were to have a url like https://example.com/books, that contained several links to urls such as: https://example.com/books?id=foo https://example.com/books?id=bar https://example.com/books?id=...
2
votes
0answers
146 views

Is it safe to do a htaccess rewrite for mobile traffic to amp pages?

I have a requirement to use the same URL for both desktop and mobile devices. On mobile, I want to serve amp HTML while on the desktop I want to render normal HTML. In such case is it safe (from SEO ...
1
vote
0answers
27 views

Apache VHost rewrite rule not working as it should

I have setup an Apache server inside my domain and have been creating VirtualHost in the httpd-vhosts.conf file. Up until now this has worked without issue, I have a few DNS entries externally that ...
1
vote
0answers
51 views

Password protect a website only if it is the dev site [closed]

I am trying to password protect a website only if it is the dev site using .htaccess and .htpasswd I am using Apache 2.4.29 on Ubuntu 18.04 Here is what I have in the .htaccess file <If "%{...
2
votes
1answer
436 views

Removing PHP Extension in sub directory

I use the following rewrite rule to remove the .php extension from my page urls: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] This works great in the root directory of my ...
2
votes
1answer
50 views

Apache rewrite to www. unless it is a dev domain

Here is my current rewrite code in my htaccess file: RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://www.%1%{...
2
votes
1answer
41 views

Order of RewriteRules is affecting the result

This is my current .htaccess: RewriteEngine On RewriteRule ^([\w-]+)/([a-z0-9]+)/([a-z-0-9]+)$ index.php?p=$1&bay=$2&map=$3 [L] RewriteRule ^test/([\w-]+)/(\d+)$ index.php?page=$1&tab=$2 [...
1
vote
2answers
806 views

Forcing trailing slash at end of “fake” folders

The working codes that I've found here most put a slash in everything. I just need force trailing slash in these "fake dirs" (that are part of my rewriting scheme (only directories)) and keep ...
3
votes
1answer
937 views

Multiple rules to rewrite the url

Why both rules don't work together and how can i fix it? Only the first one works... I think that there's a conflict between the two rules, but i did not found a solution yet ?p= is the querystring i ...
1
vote
1answer
96 views

FrontController dosen´t work

i have a example FrontController, its really simple. index.php: if (isset($_GET['page'])) { $requested_page = $_GET['page']; } else { $requested_page = 'home'; } switch($requested_page) { ...
2
votes
1answer
154 views

How to rewrite specific pages using mod rewrite?

Assuming that my website homepage is https://example.com/test-website/. What I want to do is to add a query string at the end of the homepage URL and on all pages that start with https://example.com/...
2
votes
1answer
39 views

Can I use a rewrite rule to send all requests to a single file?

Can I make a single regular expression for all my RewriteRules? I'm rewriting everything to a single file and this this acts like a front-controller. My example: RewriteRule ^de/kontakt/anfahrt$ ...
1
vote
1answer
86 views

Wordpress or Apache or Nginx matching partial URL to full URI

I have a weird issue where either Nginx or Apache (I can't tell which - but I'm 90% sure it's Apache - Nginx is reverse proxying) is matching a partial URL to a full, random URL. For example: https://...
4
votes
3answers
2k views

Best SEO practices for mobile URLs: 301, rel=canonical, or something else?

I am developing a site with a mobile version and am trying to figure the appropriate way to manage the URLs for search engines. So far I've considered: Having a separate mobile site (m.example.com) ...
2
votes
1answer
324 views

Redirect to remove everything after the second slash (first directory)

I'm trying to redirect a lot of pages on a website I own. There are a few pages indexed and I need to fix them for example: /vloerafwerking/projecttapijt/raamafwerking/ needs to go to /vloerafwerking/...
1
vote
2answers
33 views

How to preserve ALL website's URLS when transferring to a new CMS as well hosting

I am in a position where I have to figure out how to preserve all of the website's pages URLS when transferring it to a new CMS, perhaps potentially Joomla (hasn't been decided yet). New hosting is ...
1
vote
4answers
16k views

Remove folder name from rewritten URLs

Consider this URL: http://example.com/gallery/20141111-some-title In this URL I want to hide gallery/: http://example.com/20141111-some-title How can I achieve this using mod_rewrite? I used ...
1
vote
1answer
35 views

How is the mapping done from …/script.php?one,1 to …/script/one/2?

There is a PHP script which evaluates one or two parameters via QUERY_STRING. This script should process the parameters via QUERY_PATH. The PHP file type should be omitted. Request of the form https:/...
1
vote
2answers
2k views

How do I force a www subdomain on both HTTPS and HTTP?

For whatever reason I can’t seem to get this right. I’ve looked at many examples on here and on the Apache website. I’m trying to force www.example.com instead of example.com on both HTTP and HTTPS, ...
2
votes
1answer
2k views

IIS URL Rewrite: Pattern starting with forward slash never matches

I am using IIS URL Rewrite and this one has stumped me. I am redirecting a URL with specific subfolder to a new URL. e.g. https://myapp.example.com/customsite1 redirected to https://newsite1-myapp....
2
votes
1answer
70 views

Rewrite rule not taking effect

I need to place a rewrite rule in my .htaccess file so that requests for http://example.com/jbossas/jboss-configuration are redirected to: http://example.com/jboss-server/jboss-configuration So I ...
1
vote
0answers
101 views

Infinite redirect loop with IIS 8.5 Drupal

After configuring my website, i stuck in a infinite redirect loop. I have 6 domains, example.com is main domain. example1.com, ..., example5.com are forwarding to example.com. Doesn't matter which ...
0
votes
1answer
182 views

SEO: Is a redirect without using 301 but a PHP script, OK?

I've been reading about redirection, and how it can affect (or not if done properly) SEO. I'm changing my website's content platform from Drupal to a PHP custom made code. In my current site I have ...

1 2 3 4 5 10