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)

3
votes
1answer
164 views

How to organize millions of static files to serve efficiently over the web?

I'd like to create a service to serve several hundred thousand smaller files (from 5kb to 500kb, mostly around 10-100kb). Think of it as a kind of gravatar.com which serves those little avatar pics on ...
3
votes
1answer
57 views

Multiple rule Apache rewrite

I am trying to set up a hierarchy five levels deep with mod_rewrite. This is what I have put together at this point. It works for the last two levels (the first and second rule) but not after that. ...
1
vote
0answers
272 views

How to rewrite using htaccess if the file exists in another folder?

We are trying to rewrite to another folder if the file does not exist in the document root, but does exist in the other folder. The other folder is in a completely different location, which is ...
0
votes
1answer
589 views

How to forward to Amazon S3 when in maintenance mode with nginx using 503?

During website maintenance, it is sometimes necessary to shutdown our website. Our current method is to touch a file which will trigger the web server (nginx) to redirect traffic to a maintenance ...
0
votes
0answers
43 views

How can I use AAR and RewriteModule to proxy AJAX requests?

Using IIS 7.5 with Advanced Application Routing. I have setup a rewrite rule so that all requests to http://server1/proxy/* goto http://server2:8080/* eg: a request to ...
1
vote
2answers
662 views

Apache2 mod_rewrite + userdir

I have an Ubuntu Server (web) with the following configuration Version: 13.10 Installed: Apache2, apache2 utils, php5 Enabled: rewrite, userdir Problem When I try to use rewrite rules, for example ...
0
votes
1answer
788 views

How to explicitly apply percent escapes to a URL in nginx?

I have the following configuration: location ~ ^/((index\.php|robots\.txt|admin|static|uploads|api)(/.*)?)$ { proxy_set_header Host $http_host; proxy_pass http://localhost:1337/$1?$args; } ...
0
votes
1answer
997 views

Apache misbehaving (returning 404s)

CentOS 6.4 64-bit Apache 2.4.6 PHP-FPM 5.5.4 Homepage from root loads fine http://csillamvilag.com But all other pages return 404 (CMS is WordPress). I am also able to access and log into WordPress ...
0
votes
2answers
368 views

Conditionally Rewrite Email Headers (From & Reply-To) Exchange 2010

I have a client who maintains Company A (with email addresses %username%@companyA.com) and they own the domain companyB.com however there is no "infrastructure" (no Exchange server) set up ...
0
votes
1answer
172 views

Nginx upstream returning port - How to rewrite $host?

I am using Nginx and am using proxy_pass to proxy through to upstream application server. This is working fine, however the server responds with https://domain.com:81/ How can I rewrite the host from ...
2
votes
2answers
3k views

Add trailing slash when it's missing in nginx

I'm running Magento on Nginx using this config: http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/configuring_nginx_for_magento. Now I want to 301 all URLs without trailing slash ...
0
votes
1answer
595 views

IIS7 URL Rewrite - Checking for X-Forwarded-For header

I am pretty familiar with IIS and URL Rewrite but I just got a task which stumped me. I need to check each request for the presence of the X-Forwarded-For HTTP header and, depending on its presence, ...
1
vote
0answers
240 views

nginx codeigniter rewrite: Controller name conflicts with directory

I'm trying out nginx and porting my existing apache configuration to nginx. I have managed to reroute the codeigniter url's successfully, but I'm having a problem with one particular controller whose ...
0
votes
2answers
61 views

301 redirect from non www to www issue

I have been trying to set a 301 redirect from a non www to a www domain since yesterday but it only cause problems on my site. I first tried it from the control panel of the website, then by modifying ...
5
votes
3answers
10k views

Nginx redirect one path to another

I'm sure this has been asked before, but I can't find a solution that works. A website has switched CMS services, but has the same domain, how do I set up an nginx rewrite for a single page? E.g. ...
0
votes
1answer
115 views

Getting “negotiation: discovered file(s) matching request:” error not sure why

I'm currently trying to transfer a site to a new server running Ubuntu 12.10. The site worked fine on the old server, however, the new server is giving me some problems. When I access the site, I get ...
0
votes
1answer
91 views

Apache2: Trying to map a subdomain to a subdirectory

So basically I want to have: sub.domain.com/anything -> domain.com/asub/anything I'm a bit new to this and a bit confused. The first thing I did was configure my DNS settings so sub.domain.com goes ...
1
vote
1answer
396 views

Nginx rewrite with Simple Machines Forum

I am running Nginx 1.5.6 and I use the Simple Machines Forum software. Most rewrite rules seem to work properly, with the exception of the RSS feeds. In my Nginx configuration, I have the following ...
0
votes
1answer
601 views

nginx rewrite rules with regex applied to one subdirectory only

I've been frustrated for days trying to figure this out, so any advice/help would be greatly appreciated! I've recently added a section called /links to a site at somehost.com but can't seem to get ...
0
votes
3answers
2k views

Apache > 2.2.22 rewrite rule not working?

since yesterday I'm trying to figure out how to fix the following: running phpipam (http://www.phpipam.net/) with WAMP (Windows environment). The problem I am facing is related with RewriteRule ...
1
vote
2answers
214 views

Server remembering old rewrite rules, even when I remove htaccess

I have set up a development server with Ubuntu and LAMP, but for some reason the .htaccess is acting strange... There is a site on there with a set of rules, when I comment them out they still work, ...
-2
votes
1answer
83 views

Rewriting .php extension to .png

I am quite new to Nginx, so my apologies in advanced for any messups. I am trying to rewrite my script titled 'test.php' to 'test.png', so when you go to 'test.png', it displays the php content, ...
1
vote
1answer
37 views

Ningx rewrite for specific dir

I have to admit I am completely new to WebServers and now try to figure out how to configure my nginx (for home-purpose). I have already running a web-service rutorrent on my nginx with the default ...
0
votes
0answers
67 views

htaccess Rewrite leading zero in url causing trouble

I have a database with a string column made up of four unique digits attached to each record. I know this isn't the best way to do this but I'm kind of stuck with it. I'm trying to rewrite urls from ...
1
vote
1answer
19 views

Rewrite Rule for modifying URL structure

I am trying to create a mod rewrite rule to correctly change an existing url structure that looks like this: Old: ...
0
votes
1answer
231 views

Nginx - Rewrite Domain to Domain with full URL

I need to setup nginx to rewrite "www.test.com" to "www.new-test.com/test/test?foo=bar&bar=foo". I've tried the following code: server { listen 80; server_name test.com www.test.com; ...
1
vote
1answer
1k views

Squid url_rewrite_program is not working

I'm writing a url_rewrite module for squid in python (OS: Ubuntu 13). For now the code is just a test which should print the received stdin to a file: #!/usr/bin/python import sys,os url = ...
0
votes
2answers
4k views

nginx rewrite rule to convert URL segments to query string parameters

I'm setting up an nginx server for the first time, and having some trouble getting the rewrite rules right for nginx. The Apache rules we used were: See if it's a real file or directory, if so, ...
0
votes
1answer
94 views

nginx, php and urls with php files in them [closed]

I've just done an install of moodle and it's using urls like this for its theme: http://moodle.example.com/theme/styles.php/standard/1380191797/all nginx isn't picking up that that's a call to a ...
-1
votes
1answer
86 views

Nginx redirect sub.domain.com/users/page/somename to somename.sub.domain.com

I've been trying to redirect http://sub.domain.com/users/page/somename to http://somename.sub.domain.com etc. Any pointers?
1
vote
0answers
760 views

URL rewrite doesn’t work for magento

Web Server Rewrites in admin is set to yes. Secure and unsecure URLs do not have index.php in them. mod-rewrite is enabled and works I tried all combination with RewriteBase / in htaccess Flushed ...
0
votes
1answer
1k views

RewriteBase rule works in .htacess, but not in httpd.conf (inside <Directory …>)?

Let me explain by example... File: /var/www/example.com/public/wp-content/cache/minify/.htaccess <IfModule mod_rewrite.c> # THIS WORKS... RewriteBase /wp-content/cache/minify/ ...
0
votes
1answer
79 views

Non-working nginx rewrite rule with multiple params

I'm trying to create a rewrite rule with nginx which rewrites a non-existent image uri to dynamic page with params but failing. /images/395.4b2a-c6b.large-red/car-image.jpg to ...
1
vote
1answer
470 views

How to change $request_uri in nginx?

We get information from $_SERVER['REQUEST_URI'] not from $_GET or $_POST. I want to define $request_uri to change /example to /module/controller/action not redirect. I tried code blow to do this ...
0
votes
1answer
266 views

IIS 7.5 URL Rewrite looping

I have a webapp that is located in /subdir1/subdir2/ I'd like to simplify it for the users by adding a subdomain sub.domain.com but it keeps looping. I'd tried to add additional rules to prevent it ...
0
votes
1answer
129 views

How do I configure nginx rewrite rules to strip off the index page for a single page JS application and redirect non-hashed URLs to hashed URLs?

I'm a software developer writing a single page JS application. I am by no means a sysadmin, so please bear with me. What I would like to accomplish is for redirects to occur anytime a user hits my ...
1
vote
1answer
267 views

Does OpenLiteSpeed support Apache rewrites?

I have been getting some conflicting information - official OpenLiteSpeed pages say both that: OpenLiteSpeed supports Apache rewrites, and OpenLiteSpeed does not support .htaccess A bit ...
1
vote
1answer
286 views

nginx + regex, remove all parts of URI except the last one

With an URI like /a-part/some-part/another-part/last-part/?some_param=some_value how do I go about removing everything up to the last part with params and ultimately rewrite it to look like ...
0
votes
1answer
1k views

Nginx: Rewrite/Redirect URLs in a subdirectory to root

I want to rewrite or redirect any URLs inside a subdirectory to root, like so: www.site.com/subdirectory/item => www.site.com/item I tried this, but doesn't seem to work properly: location ...
0
votes
2answers
358 views

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 ...
0
votes
1answer
960 views

nginx serve static files directly if not matched by rewrite rules

I just moved from apache to nginx and I'm struggling with some configuration settings that doesn't seem to work. I have these rules from my previous .htaccess file that I'm trying to convert to nginx ...
2
votes
1answer
2k views

My nginx rewrite is downloading the php file

I have the following rewrite rule I'm trying: location / { index index.php index.html; rewrite ^/test$ /test.php break; } And I ...
1
vote
1answer
154 views

Nginx not sending auth headers when redirecting to a different domain

I have the following setup: server { server_name some.server; location / { rewrite ^ https://otherserver.com permanent; } } The redirect works as expected, but the ...
2
votes
1answer
645 views

Can a URL Rewrite condition compare two server variables?

I am trying to compare two server variables as part of a URL rewrite condition. But first, some context... In IIS, if you request http://www.example.com/foo and foo is a directory, IIS sends a 302 ...
1
vote
0answers
40 views

Redirect subfolder to subfolder and remove subfolder via nginx

I'm trying to redirect a subfolder to another subfolder with nginx. The hard part is removing the target subfolder from displaying, as it's a ruby app and not a true root folder. They are both on the ...
0
votes
0answers
73 views

How do you exlcude a sub-directory from an Apache rewrite ruleset?

I have a multilingual site with the root being English and a sub-directory (/es/) being a human translation into Spanish. Instead of manually updating all URLs, I have a opted to use mod_rewrite to ...
1
vote
1answer
376 views

nginx: rewrite subdomain to subdirectory without redirect

I'd like nginx to rewrite any http://api.example.org/xyz requests to actually call example.org/api/xyz behind the scenes. The tricky part too is that I'm using CodeIgniter so rather than load a php ...
1
vote
1answer
38 views

IIS 7 Exact Match Rewrite

I'm trying to setup a rewrite for my site. I've fiddled with this for days but can't get it to work right. Here is what I'm looking for: Original URL: site.com/searchresults.aspx?categoryid=6 ...
0
votes
2answers
37 views

Apache to Nginx rewrite rules

I have Apache rules for a Web application that look like so: RewriteEngine On RewriteRule ^unsubscribe/([-A-z0-9]+)/?(.*)$ /list/unsubscribe.php?id=$1&why=$2 [L,QSA] RewriteRule ...
1
vote
0answers
283 views

How to create an nginx rewrite to timthumb.php

I have a website that has many custom image sizes. I'm following this example which uses apache but I need to recreate this on an Nginx server. ...