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
2 votes
1 answer
30 views

How to modify $uri to avoid HTTP-Splitting vulnerability

How can I modify below block to overcome HTTP-Splitting vulnerability. There is an official recommendation to instead use $uri_request but unfortunately that doesn't work for below code. location /...
  • 23
2 votes
1 answer
37 views

Redirect 301 a URL already created by a rewrite rule in .htaccess

I'm creating SEO friendly URLs with rewrites in .htaccess. Now I need to redirect (301) a couple of these rewrites, and have no idea how to do that. These lines: Options +FollowSymLinks RewriteEngine ...
  • 123
17 votes
1 answer
3k views

Same Arabic phrase encoding into two different urls, why? How to handle?

I have a multi-lingual site which two arabic phrases which to my eye (and to the Arabic speakers I've asked) looks the same, but they encode differently. إعادةصياغةالنصتلقائياباللغةالعربيةمجانا ...
4 votes
1 answer
52 views

Will changing URLs with .htaccess impact my SEO negatively?

Basically, I have URL like www.example.com/month/day/name-of-post. What I want to do is to change the month/day to blog/month (or just /blog/) for continuity. I have a WordPress and the pages are ...
2 votes
1 answer
409 views

Nginx URL rewrite with static .html files for SEO

I'm trying to setup a Nginx configuration for nice URLs without .html extension. What I currently have works, but the / URI redirects to /index and I don't want that. The URL rewrite rules should be ...
  • 123
2 votes
1 answer
68 views

How to rewrite a request to different files based on the domain name in ".htaccess"?

I run the website https://www.1.example. The contents of my .htaccess file are as follows: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ \...
  • 21
4 votes
1 answer
352 views

Modify rewrite rule to match ONLY directories, NOT directories AND files

I have the following rule in my .htaccess file: RewriteRule ^[^/].*/(dir1|dir2|dir3)(.+) $1$2 [QSA] It works great for the directories except sometimes it conflicts with files. How can I modify this ...
  • 153
1 vote
1 answer
754 views

IIS Root redirect to subfolder with HTTPS and SSL certification

I need to redirect all HTTP requests to HTTPS with a subdirectory. Currently all requests that go to http://example.org needs to be redirected to https://example.org/subdirectory. As an example: https:...
1 vote
0 answers
1k views

CDN changes URLs to cdn.example.com

I am testing a CDN. All the website URLs are being changed from www.example.com to cdn.example.com and this will lead to a SEO drop. I have followed the procedure and asked the support service, with ...
user avatar
4 votes
1 answer
289 views

Why rewrite to index.php is not working on a wordpress site?

So my rewriterule is like RewriteRule ^test$ index.php [L] I tested it on https://htaccess.madewithlove.com?share=b0a9904b-1ec4-49cd-917c-36426ff6150a it works fine. I also tested it on live Joomla ...
  • 495
4 votes
1 answer
103 views

htaccess - URL Rewrite to rewrite specific URLs but allow one subdir URL

We are using a CMS (Magento) where we are looking to have all of the current customer dashboard links redirect to the homepage, however when doing this with simple 301 rewrites, it unfortunately ...
  • 195
2 votes
0 answers
88 views

How to locally serve static website which has human readable urls | How to rewrite urls in a dev server? [closed]

So let's say there are static files - index.html ( / ) - blog -- index.html ( /blog ) -- blog-post.html ( /blog/blog-post ) Question 1: are this urls human readable? Question 2: when people use ssg ...
2 votes
1 answer
247 views

Why is this .htaccess evaluating to 302 redirect instead of internal rewrite?

As an example, I was expecting this https://example.software/credits to evaluate to an internal rewrite https://example.software?mode=credits Why is it showing up on the browser url-bar as a 302 ...
  • 1,254
2 votes
1 answer
213 views

How can I rewrite a URL to use a new path for Apache?

How can I rewrite a URL so that following is achieved: example.com/old/index.htm is redirected to example.com/new/index.htm ? I've tried to add the following RewriteRule in my server config vhost to ...
  • 297
3 votes
1 answer
36 views

We are restructuring some URLs are 301 redirects enough to avoid a massive drop in traffic?

My org is rebuilding a very old, very haphazardly built WordPress site and we are thinking about making some changes to our custom post types and therefore the URL structure will change which is going ...
  • 131
3 votes
1 answer
405 views

Redirect URL ending in certain `variable=value` query string, to `URL?variable` (i.e., strip `=value`)

I'm trying to create a 301-rewrite for URLs ending with ?amp=1 to nearly the same URL and query string, just stripping the value (=1). Examples: https://example.com/?amp=1 should redirect to https://...
1 vote
1 answer
43 views

Subdomain rewrites without using certs that don't support sub domain affecting

I am using LetsEncrypt to generate and renew my certs for my website. Unfortunately, it does not support subdomains. Having said that, I have a ton of rewrite rules that work fine. For example: ...
2 votes
0 answers
27 views

Problem with URL path when I applied SEO friendly URL [duplicate]

I was working on PHP project and making SEO friendly URL Like, OLD : http://example.com/list_product?q=men-top-wear New : http://example.com/list_product/men-top-wear Here is my .htaccess file: ...
  • 21
4 votes
1 answer
168 views

Mod Rewrite Multiple Query String

I'm having trouble using modrewrite to redirect a URL with multiple strings. I have a PDF handling script. I want to redirect something like: https://www.example.com/pdfs/samplepdf.pdf/open [or /...
4 votes
1 answer
359 views

Rewriting a folder name using .htaccess doesn't want to work

I am wondering, why folder renaming doesn't work. RewriteRule ^pl/(.*) public/$1 Let's say I have a URL like: example.com/public/index.html Now I want to rewrite the URL to example.com/pl/index.html ...
1 vote
1 answer
234 views

Url changing with htaccess

I have a web presentation with some typical url adresses. Now I need to add a rewriterule for a different languages, examples: domain/club -> do not change domain/club/path -> do not change ...
1 vote
0 answers
35 views

Modify rewrite rule to handle four ids rather than just one [closed]

I have rewrite rule which gives id from link to script and it works perfectly: RewriteRule ^index/viewproduct/id/(\d+)$ produkty/index.php?id=$1 [L] I need one more RewriteRule to handle URLS like: ...
  • 21
1 vote
1 answer
902 views

.htaccess Rewrite Wordpress Subdirectory without breaking other subdirectories

So I have WordPress installed in /wp/ but I want all WordPress URLs to be rewritten to appear in the root directory. I currently have this working (see below) but I want to change my .htaccess so it ...
1 vote
0 answers
139 views

Can a reverse-proxied Facebook in an IFRAME access the other logged-in Facebook's in other windows and IFRAMEs?

We have set up a reverse proxy to Facebook. We wound up another subdomain on our server and pointed it at https://www.facebook.com using the following web.config. (Redacted slightly for security's ...
  • 111
1 vote
2 answers
39 views

Using two domain names in a single folder

I have inherited an English/French static web site. The original developer created it so all the html files are in the root directory of the English domain and added "-fr" to the French file ...
  • 111
1 vote
1 answer
1k views

Rewrite URL with ID to one file using .htaccess

I have "home" directory as: /var/www/page I need redirect: /var/www/page/index/product/id/9098890 Where 9098890 is the id of product. to one file: /var/www/page/script/index.php I want ...
  • 21
1 vote
1 answer
64 views

Will a .com SSL certificate cover a redirecting .com.ar domain?

we have a website with 2 different domains: www.example.com or example.com and www.example.com.ar or example.com.ar I want all requests redirected to www.example.com. I know I have to create two ...
2 votes
1 answer
990 views

How can I limit .htaccess to current directory scope only?

I have something like this: Options -Indexes RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?path=$1 [NC,L,QSA] Order deny,allow ...
  • 23
2 votes
1 answer
54 views

Can I have separate url in internal navigation of website and Sitemap?

I have not so SEO friendly url structure in my internal navigation of website(some technical challenges) but marked each of the page with SEO friendly canonical(through CMS) and these canonicals are ...
1 vote
2 answers
70 views

Will /blog/ at the start of the URL path for my WordPress articles help SEO?

I have a WordPress website for a business. And they have many pages, Custom Posts, etc. And they do have a Blog also. At present their blog urls are like this: Main page for blog: example.com/blog ...
1 vote
1 answer
115 views

how fix rewrite rule conflict

I am using following rewrite rule and its working fine : 1) RewriteRule ^([^/]*)/?([^/]*)/?([^/]*)/$ estates1.php?pageNum_Clusterb=$3&estname=$1&location=$2 [L] but when add second code in ...
  • 21
1 vote
2 answers
40 views

How do irrelevant parts of restructured URL affect SEO?

I'm new to SEO and not sure how exactly google crawler works If I use the following format for URL: example.com/category/id/name The content of the page is loaded by only the id part, the other ...
  • 111
1 vote
0 answers
20 views

SEO Rewrite , URI Without .php Extension To file [duplicate]

I have website with this output Link : https://domain1.net/estates.php?estname=XXXX&location=YYYYY I want change it to : https://domain1.net/XXXXX/YYYYY I try it with following rewrite rule : ...
  • 21
3 votes
1 answer
647 views

301 redirect rewrite query string in .htaccess [duplicate]

I am trying to perform a 301 redirect in .htaccess and I need to remove the query string ?view=full. Here is what I have that is not working: RewriteRule ^/contact/?view=full$ /contact/ [R=301,L] I ...
  • 41
0 votes
0 answers
20 views

Which URL is best [duplicate]

We are in the process of creating landing pages whose contents will be living in the server whose directory houses mylove.example.com. The URL will be mylove.example.com but for marketing purposes, ...
4 votes
0 answers
51 views

NGINX configuration for the same folder protection rewrites in each of thousands of subdirectories

The following code allows me to protect a specific folder with the membership software we're using. The problem is if we have 1,000 folders we need to protect, we need to copy/paste this same code for ...
0 votes
1 answer
19 views

URL Rewrite - Does order of directories matter to search engines?

So a pretty straight forward question here. Should the directory structure created from url parameters such as: /color-brown/shape-square/material-wood/ remain consistent? Does it matter if you also ...
  • 103
2 votes
1 answer
2k views

mod-rewrite - sending any URL with ".php/" to 404

I have a substantial number of rewrite rules in place for a variety of reasons such as: disallow indexes, set custom error pages, force non-www, https, strip trailing slash, redirect index.html or....
  • 61
1 vote
0 answers
70 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 ...
  • 1,147
2 votes
1 answer
50 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?
  • 23
-1 votes
1 answer
29 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
2 answers
71 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
1 answer
275 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}...
2 votes
1 answer
328 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
2 answers
719 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
1 answer
79 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
1 answer
179 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 ...
  • 13
2 votes
1 answer
1k 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 ...
  • 323
4 votes
1 answer
93 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 ...
3 votes
1 answer
655 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/...
  • 163

1
2 3 4 5
10