Questions tagged [rewrite]

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.

2112 questions
4
votes
3 answers

How to redirect root to subdirectory while maintaining URL in the address bar

I have an nginx setup with folder structure like this: - www |- splash |- blog www is the root folder. I would like to redirect users who access http://example.com to the splash folder. But I don't want the URL in the address bar to change to…
Goni
  • 41
  • 1
  • 1
  • 2
4
votes
2 answers

Nginx Rewriting : PHP file inside of Location directive not served

I am trying to redirect a subdirectory to a php file. Instead of serving the file, it downloads it, meaning that it does not read it as a php file. More exactly it does not enter the fastcgi location ~ \.php$ directive. Some interesting facts…
Tristan
  • 143
  • 1
  • 5
4
votes
1 answer

Tomcat url rewrite fails with 404, but browsing directly returns a 200

I have a web application deployed in webapps/appname and I'm trying to add in rewrite rules to example.org/appname-slow to rewrite to example.org/appname?delay=1. I have the following in webapps/ROOT/WEB-INF/web.xml
R. S.
  • 1,714
  • 12
  • 19
4
votes
2 answers

How do I set up URL Rewriting to a Heroku instance?

I'm more of an engineer than a devops guy, so please excuse me if this is extremely basic. My situation: I have a server on the example.edu network, so I don't control the main DNS interface to example.edu. Therefore I don't believe I can use…
ramanujan
  • 141
  • 1
  • 3
4
votes
1 answer

Nginx rewrite: remove .html from URL with arguments

How can i remove the .html from an url with argument? eg: http://www.domain.com/somepage.html?argument=whole&bunch=a-lot to: http://www.domain.com/somepage?argument=whole&bunch=a-lot I have tried location / { index index.html index.php; …
Nicovs_be
  • 99
  • 1
  • 5
4
votes
1 answer

nginx: [emerg] unknown "script_filename" variable

I'm receving this error when trying to use script_filename nginx: [emerg] unknown "script_filename" variable nginx: configuration file /etc/nginx/nginx.conf test failed However script_filename is defined in : fastcgi_params fastcgi_param …
Linux Intel
  • 183
  • 2
  • 3
  • 16
4
votes
4 answers

NGINX redirect subdomain to sub directory

I know this must have been answered a million times but I can't seem to get it to work I would like to redirect a subdomain to a subdirectory. I am currently using server { server_name sub.domain.com; rewrite ^(.*)…
John
  • 61
  • 1
  • 1
  • 3
4
votes
1 answer

Nginx rewrites - When does one use the break flag (pattern target break)?

The nginx wiki states: break - completes processing of current rewrite directives and non-rewrite processing continues within the current location block only. Is this to say that: If the rewrite pattern matches, process the rewrite (rewrite to…
anonymous-one
  • 1,018
  • 7
  • 27
  • 43
4
votes
2 answers

Nginx Mod Rewrite - Rewrite *.png to *.php

I am having an issue with Nginx Rewrites Currently my rule is as seen below rewrite ^/i/(.*?)$ /i/$1.php last; Basically what I want to do is redirect all .png files to .php within the /i directory. However, it seems that the $ has to be at the end…
Ben
  • 41
  • 1
  • 2
4
votes
1 answer

Nginx rewrite all html files except index

I'm having a bit of trouble with Nginx rewrites. I recently moved by blog over to a new engine, and the URL structure has changed. On my old blogging engine posts were located at a URL with the form http://$host/yyyy/mm/title.html however on the new…
Sam Whited
  • 216
  • 3
  • 9
4
votes
4 answers

Static error page served by nginx when my application is down

If my (Rails) application is down or undergoing database maintenance or whatever, I'd like to specify at the nginx level to serve a static page. So every URL like http://example.com/* should serve a static html file, like…
dreeves
  • 238
  • 1
  • 3
  • 9
4
votes
2 answers

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 how to do this. Can you help me? Thanks in…
Martho
4
votes
1 answer

nginx proxypass rewrite base url

I'm trying to setup Nginx to forward requests to several backend services using proxy_pass. A few of them don't support being accessed under a sub-folder, so I have to add a rewrite to strip the sub-folder which is appended to allow access to them…
Thermionix
  • 917
  • 2
  • 15
  • 28
4
votes
4 answers

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 (presuming you also have a 'standard' website…
warren
  • 18,369
  • 23
  • 84
  • 135
4
votes
1 answer

IIS IP Logging through reverse Proxy (Cloudflare)

I'm using an IIS server behind the nice "Cloudflare" reverse proxy. This reverse proxy farm exposes a HTTP header to my server, namely HTTP_CF_CONNECTING_IP. It contains the IP that connects to Cloudflare, so I can actually see who's connecting. Now…
sinni800
  • 263
  • 2
  • 11