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.

learn more… | top users | synonyms (5)

15
votes
5answers
859 views

How can I enforce that my urls always start with www?

I want to ensure that users come to www.mydomain.com even if they arrive through the alias mydomain.com. This is so that I have control over cookies on subdomains, and so that Google sees one single ...
8
votes
9answers
712 views

Recommendation: Company website forced to https?

My company wants their "informational" website to be rewritten from HTTP to HTTPS. Technically this is not a big deal for me. But i have doubts if this is state-of-the-art since the only reason they ...
8
votes
2answers
3k views

mod_rewrite does not forward GET parameters

I'm having trouble setting up Apache with mod_rewrite on my development machine. Mod_rewrite is active, and works well for some rules. Some rules do not work as intended, like this one: RewriteRule ...
7
votes
8answers
9k views

How to inject HTML code into every delivered HTML page?

I've got an Apache web server that delivers static HTML pages. For some reason I can't change the files themselves, but I still want to inject some HTML into every page that is being served. Is this ...
7
votes
3answers
1k views

Remove “www” and redirect to “https” with nginx

I want to create a rule in nginx that does two things: Removes the "www." from the request URI Redirects to "https" if the request URI is "http" There are plenty of examples of how to do each of ...
6
votes
2answers
5k views

How to port Apache rewrite rules to cherokee?

I'm pretty new to cherokee, it's great and pretty straight forward except URL Rewrites. Is there a straight forward guide to it? Let me know. Also how would I port this: RewriteEngine on RewriteCond ...
6
votes
2answers
1k views

“Hide” .html file extensions using nginx rewrites

I'm serving up a static site via nginx, and my goal is to replace URL's that look like: http://foo.com/bar.html with http://foo.com/bar The key being no trailing slash. I am currently doing ...
6
votes
2answers
3k views

nginx url rewriting: difference between break and last

I don't understand the difference between break and last (flags of rewrite). The documentation is rather abstruse. I've tried to switch between the two in some of my configs, but I couldn't spot any ...
6
votes
1answer
2k views

IIS 7.5 Redirect / URL Rewrite to mobile version of website

I'm looking for an IIS solution (not programming) to redirect a website to a mobile version of the website. It looks like it might be possible, but not sure, with IIS Redirect or using IIS URL Rewrite ...
6
votes
2answers
2k views

What should my Nginx rewrite rules be for Rails with Passenger for page caching in a subdirectory?

I'm using Nginx 0.7.64, Passenger 2.2.9, Rails 2.3.5. I have my page caching directory set to /public/cache, and I'd like to be able to serve cached pages when requested over HTTP, but always hit the ...
5
votes
4answers
2k views

nginx subdomain rewrite

Yet another nginx rewrite rule question How can I do a rewrite from http://www.*.domain.com to http://*.domain.com ? thanks in advance -- Deb EDIT: I'm sorry I didn't see the textile formatting ...
5
votes
1answer
3k views

How can I export URL rewrite rules?

Is it possible to export URL rewrite rules for IIS7? I am setting up a duplicate of a website for internal use (testing) and want to duplicate all of the URL Rewrite rules without having to manually ...
5
votes
4answers
2k views

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 ...
5
votes
3answers
1k views

Apache: Where to examine the redirection logs?

I have complicated RewriteCond and RewriteRule in one machine. And according to these rules some of the request will be redirected to another machine. So is there an Apache log that shows clearly how ...
5
votes
2answers
8k views

Nginx rewrite URL only if file exists

I need to write a rewrite rule for Nginx so that if a user tries to go to an old image url: /images/path/to/image.png and the file doesnt exist, try to redirect to: ...
5
votes
2answers
1k views

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. ...
5
votes
1answer
783 views

.htaccess rewrite http to https results in loop

On an apache 2.2 server running varnish, I am trying to redirect http -> to https for an entire Drupal Commons (http://commons.acquia.com/) site. Since varnish caches some redirects (R=301, but not ...
5
votes
2answers
1k views

IIS 7 rewriting subdomain to point at a specific port

Having installed Team Foundation Server 2010 on Windows Server 2008, I need an easy URL for our developers to access their repositories. The default URL for the TFS repositories is ...
4
votes
4answers
1k views

Hiding non-standard ports in the address bar?

Some applications (such as Plone) default to serving http on ports other than 80 (eg 8080). Typically, to view those webapps you need to load http://mysite.tld:8080 instead of just http://mysite.tld ...
4
votes
3answers
7k views

nginx + PHP-FPM = “permission denied” error 13 in nginx log; configuration mistake?

I've got nginx 0.7x + PHP-FPM running under PHP 5.2.10 on one RHEL5 server, but trying to duplicate that setup under the bundled-in PHP-FPM in PHP 5.3.3 on a second server, I'm having some trouble ...
4
votes
2answers
3k views

Redirecting to the IP of an amazon EC2 instance

As you know amazon EC2 instances get an address like: ec2-72-44-40-153.z-2.compute-1.amazonaws.com If I have the domain example.com, is there any way that I can make bob.example.com or preferably ...
4
votes
1answer
4k views

Nginx: Rewrite rule for subfolder

I have a subdomain where I want to keep projects I am working on, in order to show these projects to clients. Here is the configuraion file from /etc/nginx/sites-available/projects: server { ...
4
votes
3answers
1k views

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 ...
4
votes
2answers
6k views

how to restrict access to directory and subdirs

I need to restrict access to any files or subdirs in direstory "testdir". My conf: ... location ~* ^.+\.(jpg|txt)$ { root /var/www/site; } location /testdir { deny all; ...
4
votes
1answer
1k views

nginx: rewrite all except one location

Right now my nginx is rewriting several domains to one main domain which we are using. Here's one rule from my config: server { listen X.X.X.X:80; server_name .exampleblog.org; rewrite ^(.*) ...
4
votes
2answers
129 views

Can I make a simple calculation within a RewriteRule?

A change in how a site is structured means urls need changing from site/11-foo/21-bar to site/1-foo/1-bar i.e. I want to use a RewriteRule to subtract a constant (in this example, 10) from ...
4
votes
2answers
4k views

Apache Virtual Host Config www vs non-www, Rewrite or sServerAlias?

We have a central httpd.conf and we include confs for various virtual hosts. Until today, we didn't really have a need for "www.subdomain.site.com" domains, only "subdomain.site.com." Now we do, so I ...
4
votes
2answers
175 views

Why does a $1 backreference work in a rewrite with no subgroups?

Someone I'm working with committed a RewriteRule such as the following to SVN: RewriteRule ^admin/ebay.*$ /yii.php/$1 [L] I warned him that it may not work because there is no subgroup in the match ...
4
votes
2answers
730 views

URL rewrite in IIS 7

I have a question. I'm using IIS 7 URL rewrite. It works fine, but now I want this: http://www.example.com/http://www.domain.com to be: http://www.example.com/www.domain.com I have no clue on ...
4
votes
1answer
519 views

IIS7 and URLRewrite is failing with Wordpress 3.1.1 Redirects

I'm having an interesting issue with the migration to wordpress 3.1.1 multisite and the url rewrite rules. the index.php routing, as well as the ms-files.php?file= rules are failing across the board. ...
4
votes
4answers
3k views

Configure IIS 7 Reverse Proxy to connect to TeamCity Tomcat

We have an IIS 7 webserver configured and would like to create a reverse proxy for a TeamCity installation using Tomcat on the same machine. The IIS server site is https://somesite and I would like ...
4
votes
1answer
215 views

How to redirect elgantly many redirects in htaccess?

Q1. is it possible to further optimize / compact the following rules, thereby making the entire redirections faster and easier to maintain in future? There are about twenty of these domains!! you get ...
4
votes
0answers
368 views

gallery2 and nginx with rewrite return file not found for file name with space (or + sign in url)

I have setup nginx with gallery2 on an internal server. Everything works fine under apache2 which I checked first, it used to be on apache2. Problem is: gallery2 seems to generate url with '+' sign ...
3
votes
2answers
3k views

NGINX Redirect Rule: Subfolder only to HTTPS?

I'm trying to redirect anyone who access the admin section of my site to the HTTPS version of it. The current rewrite rule is as follows: server { listen 80; server_name ...
3
votes
4answers
8k views

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 ...
3
votes
1answer
210 views

Is it possible to rewrite some query strings to HTTPS and keep everything else on HTTP?

I'm rewriting query strings to pretty URIs, example: index.php?q=/en/contact becomes /en/contact and all works nicely.. # httpd.conf # HANDLE THE QUERY RewriteCond %{REQUEST_FILENAME} !-f ...
3
votes
2answers
318 views

How to create this type of subdomain: example.test.domain.com

I've managed to find a rewrite for making subdomains (which I have a wildcard domain pointed to my server; *.domain.com. If I go to test.domain.com, it works just fine which transverse to: ...
3
votes
2answers
1k views

IIS7 URL Rewrite breaks for URLs containing + characters

I have an IIS7 server that acts as a reverse proxy for several other web servers. The other servers run on different ports, so the IIS7 server provides 'friendly URLs' and all on port 80. URL ...
3
votes
3answers
3k views

How to rewrite the domain part of Set-Cookie in a nginx reverse proxy?

I have a simple nginx reverse proxy: server { server_name external.domain.com; location / { proxy_pass http://backend.int/; } } The problem is that Set-Cookie response headers contain ...
3
votes
4answers
361 views

Nginx rewrite rule “^/([a-z0-9]{32})\.png$” not working (used to work on Apache)

I have these rewrite rules (I tried both with no avail): location ~* "^/([a-z0-9]{32})\.png$" { rewrite ^ /index.php?page=log&id=$1 last; } and location ~* ...
3
votes
1answer
95 views

Nginx: Rewriting directory path to file

I'm a little new to Nginx here so bear with me - I want to rewrite a url like foo.bar.com/newfoo?limit=30 to foo.bar.com/newfoo.php?limit=30. Seems pretty simple to do it something like this ...
3
votes
1answer
1k views

ProxyPass entire domain to Tomcat, including root

I have configured my VirtualHost example.com to proxy all requests to a Tomcat server ProxyPass / http://localhost:8088/app ProxyPassReverse / http://localhost:8088/app This works fine for URLs ...
3
votes
2answers
2k views

Precedence of RewriteRules in .htaccess file on Apache Server

I have a number of RewriteRules in my .htaccess file. However, one specific rule is only executed if I remove another specific rule, regardless of how I order the two rules. Here's the rule which ...
3
votes
1answer
122 views

It it possible to have multiple ReWrite rules that all do the same Action, for an IIS7.5 webserver?

I've got rewrite module working great for my IIS7.5 site. Now, I wish to add a number of urls that all goto an HTTP 410-Gone status. Eg. <rule name="Old Site = image1" patternSyntax="ExactMatch" ...
3
votes
2answers
228 views

How do you make a CMS and existing asp.net applications live together peacefully in IIS?

Our existing public website consists of a mish-mash of asp.net pages with mostly static content and some real web applications that are set up as virtual directories. We're now looking at installing ...
3
votes
1answer
169 views

Url rewriting stops working after changing default port on iis7

I have migrated the IIS6 webserver 2003 websites to IIS7 webserver 2008 using msdeploy tool. Application pool setting are changed with "Enable 32-bit Applications=true", ...
3
votes
1answer
673 views

Rewrite IIS served subdomain with content from other server/port

Our main web server is using IIS 6 and it obviously catches all port 80 traffic and we have another app served on a non-standard port (8443) that is hosted using Apache. For example: ...
3
votes
2answers
698 views

Apache-style multiviews with Nginx

I'm interested in switching from Apache/mod_php to Nginx for some non-CMS sites I'm running. The sites in question are either completely static HTML files or simple PHP, but the one thing they have in ...
3
votes
2answers
225 views

Is there an Elegant solution to rewrite long image?query-urls into cachable_nice_urls, using only apache htaccess?

this is a pain in the ass-problem! Whicever genius solves this riddle will receive paypal donation to eat diner for two. Now lets get started. Given: most proxies, do not cache resources with a "?" in ...
3
votes
1answer
3k views

How to rewrite a redirected url with haproxy?

I'm trying to proxy all requests to /static/pdfs to a cdn that has the same filenames but doesn't have the /static/pdfs prefix. I can do this easily with nginx like this: location ^~ /static/pdfs/ { ...

1 2 3 4 5 18