URL Rewriting maps an incoming URL to a modified URL, so that the request is processes as if the original request was made to the modified URL. This is often used to provide more search engine friendly URLs.
Questions tagged [rewrite]
2112 questions
9
votes
3 answers
What URL should the browser display with this DNS configuration?
If I have the following records in the DNS:
hostname Record Type address
benmccormack.com A 216.10.244.61
www.benmccormack.com CNAME benmccormack.com
What should the user expect to see…

Ben McCormack
- 705
- 4
- 9
- 16
9
votes
1 answer
Apache 2.2 redirect all but one directory
I have this in my httpd.conf file:
ServerName example.com
Redirect Permanent / https://example.net/
This is successfully redirecting everything formerly at http://example.com to its new…

FKEinternet
- 291
- 2
- 4
- 11
9
votes
1 answer
Haproxy "use_backend" match order
I have a problem with HAProxy, it's a snippet of my haproxy.cfg below,
acl url_a path_beg /a
acl dom_eye hdr_dom(host) -i www.mydomin.com
use_backend eye1 if dom_eye
use_backend eye2 if dom_eye url_a
when i visit www.mydomin.com/a, it use eye2…

glancesx
- 91
- 1
- 1
- 2
9
votes
2 answers
nginx redirect to www.domain
I want to redirect the site ALWAYS to www.site.com. However, I am not sure as to how to get the WWW to always show up in front should say someone type in the domain without the www.
EDIT:
server {
listen 80;
server_name site.com;
…

Jake Thomas
- 105
- 2
- 3
- 6
9
votes
2 answers
NGINX rewrite syntax inside location block
A stupid question perhaps, but I can't seem to find good documentation or examples for this...
When you're using location blocks to filter incoming requests, do you do your rewrite from the matched location or from the start of the request?
An…

probablyup
- 258
- 1
- 2
- 5
9
votes
1 answer
IIS URL Rewrite Module Query String Parameters
Is it possible to use URL Rewrite to provide more complex query string functionality than the "Append query string" checkbox that it has? Specifically, is it possible to specify the keys for certain query string parameters and have it only append…

Jason Kresowaty
- 501
- 2
- 6
- 20
9
votes
4 answers
multiple sub_filter rules for a reverse proxy on nginx?
with no evil plans I am trying to mirror a site under other domain, while changing a few strings on the fly.
I set up nginx on a new host to serve as a RP to the master site.
This allows to set one rule of replacement:
sub_filter Originalstring…

Sergiks
- 249
- 3
- 5
- 11
9
votes
4 answers
Why do I get a double trailing slash depending on where my RewriteRule is located?
I am using the following code to direct all www requests to non-www URLs:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.org$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
This works great inside an .htaccess file in the root of…

davekaro
- 193
- 1
- 3
8
votes
2 answers
Apache: Send pre-packed gzip'ed files
I want Apache to send static files gzip'ed over the wire, but also want Apache to not always gzip them over and over again. So I thought if it wouldn't be possible to deliver an .gz file if it exists. This set-up:
File structure:
static/
|
|---…

Boldewyn
- 239
- 4
- 13
8
votes
4 answers
How do you configure IIS 7 to use a subdirectory as the default document?
So I have a website running on a discount asp.net account, and I put an asp.net mvc app in a subdirectory. If my url is 'www.website.com' and my app is in directory 'sample', then 'www.website.com/sample' will execute the mvc app.
My problem is that…

Mark Rogers
- 279
- 1
- 4
- 14
8
votes
2 answers
Redirect traffic based on url to different ip address maintaining port and url information
We have a QA version, a UAT version, and a DEV version of webapp. Users need to access these via http://uat.company.com:41002/webapp, http://qa.company.com:41002/webapp, and http://dev.company.com:41002/webapp. There is also a different webapp on…

Mitch Kent
- 261
- 1
- 2
- 11
8
votes
4 answers
FallbackResource in subdirectory
I manage a large number of PHP applications using front controllers and the following htaccess file:
FallbackResource /index.php
Yes, that is the entire file (for each application)!
However, a few of the sites are in subfolders, necessitating the…

Moshe Katz
- 3,112
- 5
- 28
- 43
8
votes
2 answers
nginx serving alternate location on 404
I'm trying to set up an nginx config as follows: When receiving a request like /tile/SteveCountryVic/1/2/3.png:
Attempt to pass it through to http://localhost:5005/1/2/3.png
If that 404s, pass it to another server as…

Steve Bennett
- 5,750
- 12
- 47
- 59
8
votes
4 answers
nginx rewrite base url
I would like the root url
http://www.example.com
to redirect to
http://www.example.com/something/else
This is because some weird WP plugin always sets a cookie on the base url, which doesn't let me cache it.
I tried this directive:
location / {
…

ptn777
- 115
- 1
- 1
- 4
8
votes
2 answers
Using nginx to rewrite urls inside outgoing responses
We have a customer with a site running on Apache. Recently the site has been seeing increased load and as a stop gap we want to shift all the static content on the site to a cookieless domains, e.g. http://static.thedomain.com.
The application is…

Kev
- 7,877
- 18
- 81
- 108