Questions tagged [redirect]
HTTP or HTML mechanisms used for redirecting browsers to where the actual content is located
165
questions
285
votes
5
answers
116k
views
Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About mod_rewrite Rules but Were Afraid to Ask
This is a Canonical Question about Apache's mod_rewrite.
Changing a request URL or redirecting users to a different URL than the one they originally requested is done using mod_rewrite. This includes ...
57
votes
10
answers
79k
views
How to use DNS/Hostnames or Other ways to resolve to a specific IP:Port
This is a Canonical Question about DNS/Hostnames resolution to IPs/Ports
Example 1
I'm running a web server on port 80 and another on port 87. I would like to use DNS so that www.example.com goes to ...
554
votes
11
answers
602k
views
In Nginx, how can I rewrite all http requests to https while maintaining sub-domain?
I want to rewrite all http requests on my web server to be https requests, I started with the following:
server {
listen 80;
location / {
rewrite ^(.*) https://mysite.com$1 ...
262
votes
7
answers
69k
views
What’s the point in having “www” in a URL?
Other than for historical reasons, is there is reason to have “www” in a URL?
Should I create a permanent redirect from www.xyz.com to xyz.com, or from xyz.com to www.xyz.com? Which one would you ...
89
votes
4
answers
343k
views
Nginx Redirect via Proxy, Rewrite and Preserve URL
In Nginx we have been trying to redirect a URL as follows:
http://example.com/some/path -> http://192.168.1.24
where the user still sees the original URL in their browser. Once the user is ...
237
votes
7
answers
344k
views
How to force or redirect to SSL in nginx?
I have a signup page on a subdomain like: https://signup.example.com
It should only be accessible via HTTPS but I'm worried people might somehow stumble upon it via HTTP and get a 404.
My html/...
39
votes
3
answers
125k
views
Nginx - How to redirect users with certain IP to special page
I run quite a big image gallery and there are 5 visitors that create an enormous amount of traffic by downloading the whole site every day using webcopiers. Those visitors have static IPs as it seems. ...
83
votes
4
answers
203k
views
How to get Apache2 to redirect to a subdirectory
I am running apache2 on Debian etch, with multiple virtual hosts.
I want to redirect so that http://git.example.com goes to http://git.example.com/git/
Should be really simple, but Google isn't ...
72
votes
4
answers
295k
views
Redirect URL within Apache VirtualHost?
I have a dedicated server with Apache, on which I've set up some VirtualHosts. I've set up one to handle the www domain as well as the non-www domain.
My VH .conf file for the www:
<VirtualHost *&...
61
votes
4
answers
131k
views
How to redirect root and only root via htaccess?
I want to redirect only my root to another url, but maintain all the /sub/directories where they belong (and redirect)
example:
mysite.com/1 redirects to somewhere
mysite.com/admin opens a page
i ...
21
votes
2
answers
79k
views
nginx rewrite for an url with parameters
I have an URL of this type:
http://www.example.com/?param1=val1¶m2=¶m3=val3¶m4=val4¶m5=val5
And I want to redirect it to this one:
http://www.example.com/newparam/...
12
votes
3
answers
51k
views
Convert and redirect URL in uppercase to lowercase using .htaccess
I would like to redirect a URL with uppercase characters http://localhost/A/B to a lowercase version http://localhost/a/b using the .htaccess file.
Using regex I can capture A and B but is it possible ...
7
votes
3
answers
11k
views
NGINX 301 and 302 serving small nginx document body. Any way to remove this behaviour?
We have noticed that when using nginx internal 301 and 302 handling, nginx will serve a small document body with the appropriate Location: ... header.
Something along the lines of (in html): 301 ...
86
votes
2
answers
214k
views
Best way to redirect all HTTP to HTTPS in IIS
We want ALL sites on our webserver (IIS 10) to enforce SSL (ie redirect HTTP to HTTPS).
We are currently 'Requiring SSL' on each site and setting up a 403 error handler to perform a 302 redirect to ...
27
votes
2
answers
137k
views
how do I get nginx to forward HTTP POST requests via rewrite?
My iOS app is currently accessing domain A via http POST but I would like to forward all requests to domain B.
If I use the usual rewrite ^/(.*)$ http://mydomain/$1 permanent; the POST data seems ...
19
votes
2
answers
12k
views
Redirect all requests to HTTPS, except for one subdirectory
I'm trying to move from self-signed certificates to Let's Encrypt certificates on my nginx webserver.
Currently, I redirect all requests to http/80 to https/443, which uses a self signed certificate ...
14
votes
3
answers
22k
views
How to redirect all outgoing email from postfix to a single address for testing
I am setting up a testing server for a web based application that sends some email notifications.
Sometimes testing is performed with real customer data, and for that reason I need to guarantee that ...
14
votes
7
answers
32k
views
Changing Servers - Redirect to new IP = No Downtime?
I am changing servers of my website. The IP of old server cannot be moved to the new one. To have no downtime I am planing to do the following, please someone confirm it will work:
Setup the new ...
10
votes
2
answers
11k
views
HowTo redirect HTTP to HTTPS on the same httpd?
Here is what I have got:
CentOS 5.4 (32-bit)
installed Apache httpd (Server version: Apache/2.2.11 (Unix))
mod_rewrite already presents
Question: how to redirect simple http://site.com to https://...
9
votes
2
answers
46k
views
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 {
...
3
votes
3
answers
6k
views
Nginx: Forward all Subdomains
My code doesn't work with second level tld's like domain.co.uk
Here is my conf:
# add www.
if ($host ~ ^(?!www)) {
rewrite ^/(.*)$ http://www.$host/$1 permanent;
}
# remove subdomain
if (...
37
votes
7
answers
79k
views
How do I redirect www to non-www in Route53?
I host my site at domain.com.
My DNS entries in Route53 are as follows:
domain.com A xxx.xxx.xxx.xxx 300
domain.com NS stuff.awsdns-47.org 172800
domain.com SOA ...
17
votes
5
answers
2k
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 ...
17
votes
4
answers
52k
views
Is an SSL Cert needed for redirects?
We currently have a website set to redirect to a new address (our client changed domain names, but wants the old domain to send people to the new site) in IIS 8.5 using permanant redirects found in ...
11
votes
4
answers
24k
views
SSL Certificate errors in Captive Portals
Situation: Hotel guests attempting internet access via our captive portal. Problem: Google, Yahoo and now more and more sites redirecting all home pages to HTTPS so guest gets a Certificate error when ...
8
votes
3
answers
16k
views
NGINX redirect everything except letsencrypt to https
I have a simple config, redirect everything except letsencrypt requests to https, and then have my virtual hosts only on https..
Currently all my requests are redirected to https, and then a 404 for ...
8
votes
7
answers
61k
views
How do I make Nginx redirect all requests for files which do not exist to a single php file?
I have the following nginx vhost config:
server {
listen 80 default_server;
access_log /path/to/site/dir/logs/access.log;
error_log /path/to/site/dir/logs/error.log;
root /path/to/...
6
votes
4
answers
6k
views
Redirect all non-www subdomains to main www domain with Apache2
I have a website (domain.com) and I would like to redirect all my secondary domains (domain2.com, domain3.com) and all the subdomains of these domains (*.domain.com, *.domain2.com...) to the main ...
6
votes
2
answers
13k
views
RedirectMatch and Query String
Compare these two RedirectMatch's. The first doesn't work:
RedirectMatch 302 ^/redirect\.php[?]page=(.+)$ http://somewhereelse.com/$1
Versus this, which will redirect to http://somewhereelse.com/?...
6
votes
6
answers
19k
views
Redirect specific e-mail address sent to a user, to another user
I need to redirect e-mail within our MTA when the two following criteria are both true:
When an e-mail is:
Sent from: [email protected]
Addressesd to: [email protected]
Result: redirect e-mail to ...
5
votes
3
answers
866
views
The 301 'www' nightmare. How do I change back?
About six months ago, I decided it would be best to put my website on the naked domain, let's just say 'example.com'. I did what all the instructions websites have told me with adding a 301 redirect ...
5
votes
1
answer
22k
views
IIS7.5 redirect IP to domain
But stuck on this one, looked on google but couldnt find anything.
The deployment of the site went slightly wrong and some pages were being saved as:
http://73.34.12.../page.aspx
Where the IP was ...
4
votes
1
answer
2k
views
Redirect all subdomains to main domain with HTTPS without a wildcard cert (nginx)
I have a domain name with a main site and a few vhosts. I want all sites (main and vhosts) to only be accessible through HTTPS (using HSTS), and I want non-existing subdomains to be redirected to the ...
4
votes
5
answers
4k
views
Redirect to www subdomain via DNS
Is it possible to set a DNS record to redirect all example.com/* traffic to www.example.com/*?
I'm running a Sinatra app on Heroku's Cedar stack.
I set up Heroku's Custom Domains addon, and the ...
3
votes
3
answers
8k
views
Insecure Connection: issue on www redirect to non-www with https
I am not much familiar with server configurations, please help me on this issue:
I have a Debian8 server and a SSL certificate, the SSL certificate only for My non-www domain so I would like to ...
3
votes
1
answer
19k
views
Apache Virtual Host redirect from subdomain to subdirectory
How do I redirect requests coming to http://blog.mysite.com to http://mysite.com/blog?
Reading the apache docs on when not to use the rewrite mod, I tried a simple redirect e.g.
Redirect http://blog....
3
votes
2
answers
13k
views
Possible to redirect from HTTPS to HTTP behind load-balancer?
I have a basic ASP.NET application that sits behind an F5 load-balancer.
Incoming SSL requests (over HTTPS) terminate at the load-balancer and all internal communication between the load-balancer and ...
3
votes
1
answer
16k
views
How to redirect Https CONNECT Request with Squid Explicit Proxy
I want to block certain urls for some users of my internal network. I am using a squid based explicit proxy for this purpose with a redirect_program. The clients are configured to use a pac file for ...
2
votes
1
answer
592
views
Communication between Apache and glassfish
We are currently using HTTPD server (apache) to handle client request. The requests are further proxied to a Application Server (glassfish) which provides the content. The content are static files (...
2
votes
2
answers
3k
views
NGINX - Redirecting www to non-www after redirecting http to https
I've checked out quite a few other answers to similar questions as well as tutorials on DigitalOcean, etc., with no success. Sorry for what is probably a very obvious problem - I'm new to this.
...
1
vote
1
answer
498
views
nginx: Redirect https traffic without subdomain to subdomain (non-www to www)
My current ssl certificate covers the subdomains www.example.com and static.example.com
So if a users try to access my site via https://example.com I want to redirect him to https://www.example.com . ...
1
vote
3
answers
30k
views
Is it possible to set the default web site to redirect to a virtual directory in IIS [duplicate]
Can you set up a website to make a default redirect to a virtual directory?
I tried to do this but it overrode every single website in my setup to that redirect.
I want to be able to open http://...
1
vote
1
answer
2k
views
how to redirect www.example.com to example.com via htaccess while on zend framework
as you may know zend framework uses .htaccess for redirection purposes
so when I tried to follow this advice: http://techpp.com/2010/06/28/how-to-redirect-www-urls-to-non-www-urls-and-non-www-to-www/
...
1
vote
2
answers
3k
views
Apache redirect all requests to https www
This question has been asked, but I'm not finding the solution. I have very little apache experience. I need to set up my server to take the following requests
http://, http://www. and https:// and ...
1
vote
3
answers
6k
views
Disable HTTPS for a domain that shares IP with another domain that is under HTTPS
I am running into a weird problem trying to disable HTTPS for one domain, but the other domain has HTTPS. They both are different websites running on a dedicated server, sharing the same IP address ...
1
vote
1
answer
2k
views
VirtualHost ignores ServerName and ServerAlias
I'm trying to redirect all the traffic from .se to .com but for some reason the VirtualHost ignores the ServerName and ServerAlias that I define.
<VirtualHost *:80>
ServerName www.example....
0
votes
3
answers
1k
views
apache rewrite to assign folders to domains
Please point me in the right direction.
I am using .htaccess to set-up domains on my server.
I need to domain.com to access files from /domain.com/* folder.
If a file does not exist, load /domain....
0
votes
0
answers
23
views
masking after redrection using .htaccess [duplicate]
I have read many examples that use the .htaccess file method to mask a url. None of them works for me. It might be something simple that I am missing. Please bare with me.
Here is what i want to do:
I ...
0
votes
1
answer
10k
views
apache redirect only root slash homepage [duplicate]
I need to redirect only http://example.org/ to http://www.something-other.org/ in Apache 2.4.
Just the homepage. Nothing else. I.e. http://example.org/?page=blog or http://example.org/contact.html ...
0
votes
1
answer
621
views
Apache redirect to another domain all URLs, except for ones starting with substring
Can anyone help me achieve a redirect in Apache from http://subdomain.example.com/ to http://example.com/ for all URLs, EXCEPT the ones starting with "files/"?
Thank you