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.
2,128
questions
9
votes
1
answer
29k
views
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 ...
9
votes
4
answers
37k
views
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 ...
9
votes
4
answers
52k
views
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 ...
9
votes
1
answer
848
views
Nginx simple redirect of products from old to new category
I'm making redirects of products from old to new category.
I've managed to make it work with following rule:
rewrite ^/old-category/(.*) /new-category/$1;
But I want to know when should I use "end ...
9
votes
2
answers
19k
views
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 ...
8
votes
3
answers
51k
views
Apache 2.2 rewrite - Force all requests to index.html
I need to force all requests regardless of what they are to index.html. Unfortunately everything I have tried has not worked properly.
The following seems to me like it should work but it doesn't. My ...
8
votes
4
answers
20k
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 ...
8
votes
6
answers
37k
views
How do I remove trailing slashes from a URL when using Apache's default directory index file?
I am using Apache to serve a blog which consists of static HTML files. Currently, the blog uses a pretty standard URL structure, like this:
/2010/03/21/my-awesome-blog-post/
which maps to the file
/...
8
votes
9
answers
855
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
2
answers
40k
views
Redirect traffic based on url to different ip address maintaining port and url information [duplicate]
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:...
8
votes
2
answers
31k
views
How to check if mod_alias is enabled?
I want to try mod_alias instead of mod_rewrite for a couple of simple redirect rules, but the directives don't seem to be working when entered in .htaccess. Is it possible that mod_alias is not ...
8
votes
1
answer
11k
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 like ...
8
votes
4
answers
72k
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 'www.website.com/...
8
votes
2
answers
7k
views
How Can I Configure nginx to Use Pretty URLs for Static Sites?
I've got several static sites (mostly generated by Sphinx), that I'm trying to host on my VPS. I've installed and configured nginx according to the guides, and I can successfully display my sites, but ...
8
votes
2
answers
27k
views
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. ...
8
votes
2
answers
3k
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. ...
8
votes
4
answers
6k
views
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 ...
7
votes
4
answers
47k
views
Nginx: Rewrite from base domain to a sub directory
I have a blog hosted at http://site.com/blog.
How do I instruct nginx to rewrite requests from site.com to site.com/blog?
This should not be permanent.
7
votes
1
answer
15k
views
Nginx - populate REQUEST_URI with rewritten URL
I have an Nginx configuration that is for a new PHP application that has the same functionality as another legacy PHP application, but different URLs.
I want to preserve the paths of the old ...
7
votes
2
answers
18k
views
nginx url rewriting. i just don't get it
Ok, an example url is
http://www.mysite.com/?p=account&view=settings
the p uri is a constant. all urls have it.
the view is one of many optional uri.
i've tried to understand url rewriting ...
7
votes
2
answers
6k
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 ...
7
votes
1
answer
18k
views
Url rewriting in Amazon S3
I have a webapp hosted in Amazon S3, the webapp is build with jQuery Mobile and I use changePage lo navigate between pages, I'm not using the hash operator(#) when I change the page.
I'm having ...
7
votes
1
answer
53k
views
Getting "Too many redirects" error with nginx rewrite rule
I am trying to rewrite the domain url that targets my site such that all domain names are rewritten to www.example.com and have the following config:
mysite block
server {
listen ...
7
votes
3
answers
14k
views
Set header based on %{REQUEST_URI}
I am trying to set a header based on the URI of a particular page.
I access a page using chrome.
Inspect element and see that my URI header is giving the value /bst/index.html
Now in my Apache config ...
7
votes
1
answer
5k
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 ...
7
votes
2
answers
13k
views
Rewrite URL before passing to proxy Lighttpd
I'm trying to setup a reverse proxy in lighttpd, such that all requests (and only those requests) under /mobile/video is redirected to the / directory of a secondary web server. This is pretty easy in ...
6
votes
4
answers
18k
views
Apache RewriteRule for proxying
I have a web application installed (ClockingIT) that acts based on the used subdomain. As we want to use SSL and do not have a wildcard certificate, this is not very convenient for us :-) So I thought ...
6
votes
2
answers
7k
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 go to an HTTP 410-Gone status.
Eg.
<rule name="Old Site = image1" patternSyntax="ExactMatch"...
6
votes
2
answers
10k
views
IIS re-write from http to https only for subdomains of one domain only
I have an IIS7 web server with several sites running. Some of the sites are sub-domains of one domain and the others are totally separate domains. I want to use IIS re-write to redirect all the sub ...
6
votes
1
answer
3k
views
URL rewrite rules lost upon restart
Every time I restart my server my URL rewrite rules seem to get reset. Recreating them every time is obviously frustrating!
I am running Windows Server 2008 R2 (fully updated), IIS 7.5 and IIS URL ...
6
votes
2
answers
8k
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 ...
6
votes
3
answers
21k
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 ...
6
votes
1
answer
49k
views
How do I make virtual host DirectoryIndex file appear in the url?
I have setup a virtual host which specifies a default file to load when the URL is called.
The problem I have is that I need that default DirectoryIndex file to appear in the URL.
So when I go to: ...
6
votes
1
answer
26k
views
Outbound URL Rewrite rule causes 500 server error on IIS7.0
When I added User-friendly URL using IIS URL Rewrite Module 2.0 i got this server error 500.
I followed the guide on official MS learn iis page.
I noticed when I unchecked following option "Create ...
6
votes
1
answer
54k
views
URL rewrite with multiple parameters using .htaccess
I have four different types of rewrites I'm trying to do with multiple parameters in each.
First, the URLs with no modification:
http://www.example.com/index.php?p=/category/page-slug&pn=2/
http://...
6
votes
1
answer
6k
views
Apache's mod_rewrite and PHP's REQUEST_URI variable
I have an issue with Apache passing to the PHP $_SERVER['REQUEST_URI'] variable the URL after it has been rewritten rather than the original one requested.
I am doing this rewriting because I had a ...
6
votes
2
answers
4k
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 ...
6
votes
1
answer
1k
views
Setting nginx reverse proxy with rewrite to apply to all links in site
I have the following Nginx config:
server {
listen 80;
location /test {
rewrite /test(.*) /$1 break;
proxy_pass "http://www.example.com/";
}
}
This works well for the ...
5
votes
3
answers
40k
views
URL Rewrite not available after installing on IIS 10
I can't seem to find anything about this online.
I've installed URL Rewrite via Web Platform Installer on Windows 10 running IIS 10, restarted IIS Manager, restarted IIS Server and also rebooted my ...
5
votes
3
answers
7k
views
Redirect http://example.com:12345 to https://example.com:12345 in nginx
I know this must have been answered already, but I have been searching for quite a while, and cannot find the answer. Just not looking in the right place I guess, maybe someone can help me out.
...
5
votes
1
answer
13k
views
nginx rewrite rule for using domain host to redirect to specific internal directory
I'm new to Nginx rewrites and looking for help in getting a working and minimal rewrite code. We would like to use urls like 'somecity.domain.com' on campaign materials and have the result go to city-...
5
votes
1
answer
12k
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 {
...
5
votes
2
answers
6k
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 ...
5
votes
1
answer
12k
views
Nginx rewrite without redirect
I want url domain.com/foo-111 to load contents from directory /bar/111 but not change url.
I created a rewrite rule but instead of loading contents of proper directory, it 301 redirects to domain.com/...
5
votes
1
answer
21k
views
nginx url rewrite with string substitution
I need to catch if my urls contain a small substr, keep the url as it is and rewrite only that small part, how can I accomplish this?
For example:
http://foobar.com/foo-bar-substrtocatch-baz
...
5
votes
1
answer
11k
views
Nginx rewrite *.html to *.php
I've setup my first Nginx site and the important rewrites are all done. They had to be manual, no rules would possibly have handled it, so I have a raft of rules like this to handle old URLs that ...
5
votes
2
answers
29k
views
Nginx: rewriting https:// to http://
I'm trying to get Nginx to rewrite incoming requests to a site my server prefixed with https:// to http:// (this is because a CMS used on this site forces URIs instead of relative paths -- essentially ...
5
votes
2
answers
10k
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 ...
5
votes
1
answer
13k
views
which is my Web.Config on IIS 7.5
i googled this and found it is storing inside my asp framework folder...
but may i know which is the right web.config file for my specific application ?
there is too many application running... and i ...
5
votes
4
answers
20k
views
How to redirect non-www to www without hardcoding using .htaccess?
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
...causes a perfect, non-hardcoding 301 redirect from "www to non-www", ...