Questions tagged [redirect]

HTTP or HTML mechanisms used for redirecting browsers to where the actual content is located

Tag for questions related to issues with configuration of redirects in HTTP servers, problems they may cause or solve.

Redirections are used to redirect user traffic to new location of content, as a way to handle errors or for load balancing.

They are usually implemented with HTTP redirects have status code beginning with 3. Examples include:

301 Moved permanently
302 Found (past "Moved temporarily")
2294 questions
11 answers

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 ^(.*)$1 permanent; } ... One Problem is that this…
  • 8,442
  • 5
  • 23
  • 18
5 answers

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 such things as: Changing HTTP to HTTPS (or the…
Kyle Brandt
  • 83,619
  • 74
  • 305
  • 448
7 answers

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 to, or from to Which one would you suggest and why?
Quintin Par
  • 4,373
  • 11
  • 49
  • 72
7 answers

How to force or redirect to SSL in nginx?

I have a signup page on a subdomain like: 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/server block in nginx looks like this: html { server…
  • 2,725
  • 4
  • 20
  • 15
4 answers

Nginx Redirect via Proxy, Rewrite and Preserve URL

In Nginx we have been trying to redirect a URL as follows: -> where the user still sees the original URL in their browser. Once the user is redirected, say they click on the link to…
  • 1,045
  • 1
  • 8
  • 7
2 answers

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 the https address for that specific site. This…
  • 1,573
  • 4
  • 23
  • 33
4 answers

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 goes to Should be really simple, but Google isn't quite cutting it. I've tried the Redirect and Rewrite…
Hamish Downer
  • 9,420
  • 6
  • 38
  • 51
4 answers

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: DocumentRoot /var/www/site ServerName…
  • 2,629
  • 4
  • 28
  • 36
4 answers

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: redirects to somewhere opens a page i want to redirect to and…
10 answers

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 goes to port 87. How can I accomplish this using DNS…
Tom Smykowski
  • 1,125
  • 5
  • 19
  • 27
1 answer

Capturing STDERR and STDOUT to file using tee

I'm unclear what the best order is to capture both STDERR and STDOUT to the same file using tee. I know that if I want to pipe to a file I have to map the filehandle after the redirect, i.e. find . >/tmp/output.txt 2>&1 This instructs the shell to…
  • 3,316
  • 6
  • 27
  • 31
3 answers

Simple apache2 redirect from one domain to another

What I want to do is the following: My domain no longer exists. Thus I want to do a simple redirect to the new domain It should be a redirect, that also works when someone types in the browser bar…
  • 1,259
  • 6
  • 21
  • 25
3 answers

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. What I would like to achieve is that those 5 IPs…
  • 391
  • 1
  • 3
  • 6
7 answers

How do I redirect www to non-www in Route53?

I host my site at My DNS entries in Route53 are as follows: A 300 NS 172800 SOA 900 I would like to redirect…
  • 575
  • 1
  • 5
  • 14
3 answers

Examples of 302 vs 303

What is the difference between a 302 and 303 response? 10.3.3 302 Found 10.3.4 303 See Other Are these interchangeable or why would one be used over the other? Could you please provide a use…
  • 939
  • 3
  • 10
  • 15
2 3
99 100