Questions tagged [redirect]

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

Filter by
Sorted by
Tagged with
554 votes
11 answers
593k 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 ...
MikeN's user avatar
  • 8,482
285 votes
5 answers
115k 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 ...
Kyle Brandt's user avatar
260 votes
7 answers
66k 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 ...
Quintin Par's user avatar
  • 4,423
238 votes
7 answers
340k 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/...
Callmeed's user avatar
  • 2,725
89 votes
4 answers
333k 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 ...
robjohncox's user avatar
  • 1,045
85 votes
2 answers
208k 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 ...
userSteve's user avatar
  • 1,583
83 votes
4 answers
198k 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 ...
Hamish Downer's user avatar
72 votes
4 answers
290k 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 *&...
DisgruntledGoat's user avatar
61 votes
4 answers
129k 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 ...
user avatar
57 votes
10 answers
77k 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 ...
Tom Smykowski's user avatar
57 votes
1 answer
60k views

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 . &...
PP.'s user avatar
  • 3,346
41 votes
3 answers
98k views

Simple apache2 redirect from one domain to another

What I want to do is the following: My domain xy.example.com no longer exists. Thus I want to do a simple redirect to the new domain abc.example.com. It should be a redirect, that also works when ...
JohnnyFromBF's user avatar
  • 1,259
39 votes
3 answers
122k 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. ...
Alex's user avatar
  • 391
39 votes
3 answers
32k views

Examples of 302 vs 303

What is the difference between a 302 and 303 response? http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 10.3.3 302 Found 10.3.4 303 See Other Are these interchangeable or why would one be ...
David542's user avatar
  • 969
37 votes
7 answers
75k 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 ...
fredley's user avatar
  • 575
27 votes
2 answers
132k 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 ...
Jiho Kang's user avatar
  • 1,067
27 votes
4 answers
33k views

Redirect all http requests behind Amazon ELB to https without using if

Currently I have an ELB serving both http://www.example.org and https://www.example.org. I would like to set it up so any request pointing to http://www.example.org is redirect to https://www.example....
Jordan Reiter's user avatar
23 votes
2 answers
28k views

Can you use Redirect and Proxypass at the same time

I am using Apache 2.2.15 on CentOS to provide SSL for a TomCat application. ProxyPass / http://127.0.0.1:8090/ connectiontimeout=300 timeout=300 ProxyPassReverse / http://127.0.0.1:8090 This works ...
bombcar's user avatar
  • 333
22 votes
4 answers
12k views

How to continue redirecting stdout to a file after logrotate moves it?

I have a simple script which outputs a bunch of logs to screen and I piped the STDOUT to a file to store the logs. Since this script is long running, I needed to rotate the log files so they are ...
Mehran's user avatar
  • 519
21 votes
2 answers
78k views

nginx rewrite for an url with parameters

I have an URL of this type: http://www.example.com/?param1=val1&param2=&param3=val3&param4=val4&param5=val5 And I want to redirect it to this one: http://www.example.com/newparam/...
David Morales's user avatar
19 votes
3 answers
47k views

How do i reach IPv4 addresses from an IPv6-only network?

I would like to reach this address via an IPv6 address: http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/ In our Freifunk routers there is no DNS available, so the name ...
rubo77's user avatar
  • 2,509
18 votes
4 answers
138k views

How to redirect requests to a different domain/url with nginx

I'm trying to redirect all users coming to a URL "http://example.com/something" to a URL like "http://answares.com/examples_com/something". I'm trying with code like this: server { listen 1.2.3.4:...
user93656's user avatar
  • 283
18 votes
2 answers
11k 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 ...
SaAtomic's user avatar
  • 329
17 votes
4 answers
49k 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 ...
Jeff's user avatar
  • 323
17 votes
2 answers
86k views

Nginx: Redirect IP address to domain name

With the following Nginx config: server { listen 80; listen [::]:80 default_server ipv6only=on; server_name isitmaintained.com; ... } server { listen 178.62.136.230:80; ...
Matthieu Napoli's user avatar
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 ...
Magnar's user avatar
  • 1,047
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 ...
0x6A75616E's user avatar
14 votes
2 answers
48k views

Nginx multiple roots

I'd like to divert off requests to a particular sub-directory, to another root location. How? My existing block is: server { listen 80; server_name www.domain.com; location / { ...
Michael restore Monica Cellio's user avatar
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 ...
Denis Pshenov's user avatar
14 votes
2 answers
18k views

Apache2 - 301 Redirect when missing "/" at the end of directory in the url

I haven't really noticed this Redirect(301) when requesting a url like this without slash("/") at the end: http://server/directory The server will respone with a 301 Redirect Permanent header with a ...
Jonathan Gurebo's user avatar
14 votes
4 answers
26k views

How to redirect HTTP to HTTPS on AWS Application Load Balancer?

Our website needs HIPAA compliance so everything needs to be encrypted. I don't want client to get an error message when they put in "http://mysite.com", so I need to support both HTTP and HTTPS, and ...
AussieDude's user avatar
13 votes
3 answers
38k views

IIS URL Rewrite HTTP to HTTPS with Port

My website has two bindings: 1000 and 1443 (port 80/443 are in use by another website on the same IIS instance). Port 1000 is HTTP, port 1443 is HTTPS. What I want to do is redirect any incoming ...
Andy Arismendi's user avatar
13 votes
3 answers
57k views

Redirect request to an external IP to localhost (emulate a server)

I got an application (no source code) calling a server (hard coded IP) and expecting an answer before starting (a kind of login). Cause the server is down half of the time, I want to create a dummy ...
Loda's user avatar
  • 233
12 votes
3 answers
9k views

Difference between "Redirect permanent" vs. mod_rewrite RewriteRule

This is an Apache httpd 2.2 server. We require that access to this webserver be encrypted by HTTPS. When web clients visit my site at http://www.example.org/$foo (port 80), I want to redirect their ...
Stefan Lasiewski's user avatar
12 votes
3 answers
50k 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 ...
tintin's user avatar
  • 445
12 votes
4 answers
29k views

Temporarily redirect *all* HTTP/HTTPS requests in IIS to a "server maintenance" page

We've got an IIS server that hosts hundreds of separate web apps, and the physical database server that hosts these apps is going to be taken offline for maintenance for a brief period (we expect it ...
Josh's user avatar
  • 287
11 votes
1 answer
18k views

Nginx redirect all old domain subdomains to new one

I had a very long domain, so I decided to change it to a shorter and more friendly one. But since I have a lot of subdomains (in fact, I have a subdomain wildcard), I wanted to keep the subdomain ...
ranieri's user avatar
  • 233
11 votes
1 answer
8k views

How to get Apache "Redirect" to stop appending full URL path to redirect target

If I edit the .htaccess file for a site, say oldsite.com, and put this: Redirect permanent / http://newsite.com/page It works fine if I surf to oldsite.com. But if I surf to oldsite.com/about, it ...
CaptSaltyJack's user avatar
11 votes
1 answer
19k views

nginx: rewrite all except one location

Right now my nginx is rewriting several domains to one main domain which we are using. Here's one rule from my config: server { listen X.X.X.X:80; server_name .exampleblog.org; rewrite ^(.*) ...
lorem monkey's user avatar
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 ...
user avatar
11 votes
1 answer
25k views

Nginx 1.2.2: How to get try_files to work?

I updated nginx recently to version 1.2.2 and the following entry seems to be broken; presumably a change in syntax between versions? location / { # First attempt to serve request as ...
Baldrick's user avatar
  • 4,212
11 votes
4 answers
9k views

Is there a service that will redirect your naked domain.com requests to www.domain.com? [closed]

I know this is easy with a 301 redirect in the apache config, but I'm looking for a 3rd party service that can do this cheaply or free. I'll be using this to redirect non-www traffic to a www record I'...
offthree's user avatar
  • 119
11 votes
4 answers
10k views

Amazon Cloudfront with S3 Redirect

I'm trying to do something that should be relatively straight-forward - I want to setup a few domains and subdomains to redirect to the core domain for our site, but I want to put the redirects out on ...
Chris Moschini's user avatar
11 votes
2 answers
24k views

nginx unwanted location redirect with trailing slash

I have a location location /pass/ { proxy_pass http://localhost:12345/; } So it is supposed to proxify urls http://example.com/pass/whatever to http://localhost:12345/whatever The thing I don't ...
igor's user avatar
  • 173
10 votes
1 answer
30k views

Redirecting from one nginx to another

I have got two servers (A and B) with NGINX. Server A is serving old site and server B is serving a new site. I've updated my DNS but it is quite slow: in my office I still see my old site: ...
fl00r's user avatar
  • 575
10 votes
1 answer
16k views

Nginx redirect from old domain to new with ssl

I am trying to change the domain name for my site from https://www.myolddomain.se/ to https://www.mynewdomain.se/ The problem is that for my old domain I forced SSL on all pages and therefore all ...
user246341's user avatar
10 votes
2 answers
13k views

Apache redirect and set cache headers?

Doing a redirect in Apache is easy (mod_alias): RedirectMatch ^.*$ http://portal.example.com/ Setting cache headers is equally easy: Header set Cache-Control max-age=0 Header set Expires "Thu, 01 ...
Jakob Borg's user avatar
  • 1,453
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://...
mosg's user avatar
  • 235
9 votes
2 answers
45k 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 { ...
Jake Thomas's user avatar
9 votes
4 answers
55k views

Apache: Redirect 404 and ErrorDocument 404 difference

I would like to do a 404 redirect with Apache, and I find several solutions: The .htaccess method. But I don't want to add a .htaccess if not necessary. virtual host method: <VirtualHost *:80> ...
DocWiki's user avatar
  • 683

1
2 3 4 5
47