Questions tagged [301-redirect]

The HTTP response status code 301 Moved Permanently is used for permanent redirection. This status code should be used with the location header.

Filter by
Sorted by
Tagged with
264
votes
5answers
97k 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 ...
149
votes
5answers
296k views

Nginx reverse proxy + URL rewrite

Nginx is running on port 80, and I'm using it to reverse proxy URLs with path /foo to port 3200 this way: location /foo { proxy_pass http://localhost:3200; ...
6
votes
1answer
8k views

How to stop nginx 301 auto redirect when trailing slash is not in URI?

Every time I try foobar.com/test in browser, nginx seems to redirect (301) the client to foobar.com/test/. This behaviour is unacceptable. The proxied server is a remote Apache web server. I have ...
2
votes
1answer
3k views

IIS 6 - Setting up 301 redirect for non-www to www for SEO

Someone in the marketing department ran an SEO tool against our public website and found that about half of the links to our website go to www.mycompany.com, and half go to mycompany.com. Both of ...
20
votes
2answers
6k views

Apache: What is the best way to handle thousands of permanent redirects?

We've a list of 3000 301 redirects. We need assistance on What would the best place to put these? It seems putting these 3000 lines inside vhost in httpd.conf would be a mess. What are recommended ...
10
votes
4answers
21k 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 ...
6
votes
3answers
6k 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 ...
4
votes
3answers
618 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 ...
4
votes
4answers
14k 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", ...
0
votes
1answer
410 views

301 IIS Redirect

How do I 301 direct all traffic from domain1.com to domain2.com using IIS? Also I need domain1.com/page.aspx?params to direct to domain2.com/page.aspx?params.
10
votes
1answer
13k 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 ...
5
votes
3answers
15k views

How to configure nginx to redirect all request from domain aliases to main domain?

I do have an nginx server which responds to several domains and I do want to redirect all request to the main domain. Example: website responding for xxx xxx.example.com yyy.example.com $hostname for ...
3
votes
1answer
15k views

How to permanently redirect port 8080 URL to port 80 using nginx

Because of my carelessness, I put http://www.domain.com:8080/xxx/index.html on the internet. I don't want to lose that traffic, so i want to permanent redirect that url to http://www.domain.com/xxx/...
10
votes
1answer
4k views

Empty/Null Apache request entries in access log

This entry got logged in a Apache access log: IP ADDRESS - - [00/00/0000:00:00:00 -0000] " " 301 - "-" "-" It was detected by LogWatch as a null HTTP Response and also got marked as a successful ...
3
votes
1answer
244 views

Cannot renew Public IP address SSL certificate. Any alternatives?

From what I've read and researched (here, other places) I'm almost certain what I'm asking will not be possible but any alternative suggestions are welcome. I have a server with a Public IP address ...
2
votes
1answer
930 views

.htaccess 301 redirect, same server

I set up a website at mywebsite.net, but recently bought the domain mywebsite.com. Now I updated the information on Google via Webmaster Tools and it recommended we set up a 301 redirect from the ....
1
vote
1answer
2k views

301 redirects in Apache that preserve the referrer

Our web developers are using JavaScript redirects - first of all this does not work well for SEO and secondly, it does not preserve the http_referrer (therefore it does not show up in our web stats). ...
1
vote
1answer
107 views

How to check is canonicalized domains are being used? Apache 301 redirect does not preserve referrer

I have multiple domains which are setup to redirect (301) to my main domain. However I know some of these domains have little to no value in terms of SEO and I would like to get rid of them. But a ...
1
vote
2answers
5k views

nginx rewrite from www to non-www

My nginx file doesn't file is failing and I'm not sure how. I have managed to redirect from http to https fine. But I can't get the www to redirect to non-www version. What am I doing wrong? server { ...
1
vote
3answers
3k views

mod_ReWrite to remove part of a URL

Someone has incorrectly linked to some of my urls causing 404 erros in Google Webmaster Tools. Here is an example Linked URL: http://www.example.com/foo-%E2%80%8Bbar.html Correct URL: http://www....
0
votes
2answers
537 views

Can reduce the rewriteRule to one rule from multiple RewriteConds for 301 in htaccess?

I am doing 301 redirects for old sites to a single site, rather then having to add the same RewriteRule more then once, is there a way to say write it once? that way i just need to add the rewriteCond ...
0
votes
1answer
87 views

Redirecting depends of Variables in Header

Issue I've difficulties to understand if it is possible to do redirects depends of variable in Header using Domino server (R9). AIM Redirect all requests (for 1 particular website) to: https://www....
0
votes
1answer
2k views

Nginx 301 redirection for WordPress after migration

We recently did a migration from a "custom CMS" (coded from scratch) to our current technology news/reviews site, MuyComputerPRO, which we installed in WordPress a couple of weeks ago. The migration ...