The 301 or Moved Permanently error message is a HTTP standard response code indicating that the requested resource has been assigned a new permanent URI. Future references should use one of the returned URIs.
Questions tagged [http-status-code-301]
1797 questions
26
votes
4 answers
Intercepting backend 301/302 redirects (proxy_pass) and rewriting to another location block possible?
We have a couple of backends sitting behind our nginx front ends.
Is it possible to intercept 301 / 302 redirects sent by these backends and have nginx handle them?
We were thinging something alone the lines of:
error_page 302 = @target;
But I…

anonymous-one
- 14,454
- 18
- 60
- 84
24
votes
3 answers
Rails 301 Redirection
I would like to redirect multiple entries to my landing page to one url.
The following urls, http://mysite.com and http://www.mysite.com, would redirect to http://www.mysite.com/ using 301 redirection. How can/should this be done in Rails?

Dru
- 9,632
- 13
- 49
- 68
23
votes
2 answers
nginx keep port number when 301 redirecting
I'm trying to collapse a second brand of a web app into the first brand and use 301 redirects to redirect any lingering traffic. The server is running in a Vagrant box forwarding on port 8001. I would like to have:
Instead of…

David Millar
- 1,858
- 1
- 14
- 23
21
votes
6 answers
Cannot remove 301 redirect
I stupidly did a 301 redirect on websiteA.com to websiteB.com. After removing it from the .htaccess file the redirect is still in operation. I tried from outside the local network and it is still redirecting. I have cleared my cache and tried a…

beingalex
- 2,416
- 4
- 32
- 71
21
votes
2 answers
Avoiding 301 redirect caching
This is a follow up question to Using 301/303/307 redirects for dynamic short urls, where I try to determine the best method for implementing short url redirection when the destination url will change on a frequent basis.
While it seems that 301 and…

Yarin
- 173,523
- 149
- 402
- 512
21
votes
1 answer
301 redirect vs 307 redirect
I am wondering about the difference between 301 and 307 redirects.
I am looking to generate backlinks through a home-brew url redirector, and I wish for any of the "link juice" or "page rank juice" to flow directly from the originating back page…

BBagi
- 2,035
- 1
- 19
- 23
20
votes
2 answers
Client Web Browser Behavior When Handling 301 Redirect
The RFC seems to suggest that the client should permanently cache the response:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
10.3.2 301 Moved Permanently
The requested resource has been
assigned a new permanent URI and any
future…

Jon Swanson
- 739
- 2
- 6
- 10
20
votes
1 answer
.htaccess redirect without changing address bar
I'm trying to write an .htaccess rule to redirect to a script, which further redirects somewhere else. Kind of like how URL shorteners work. However, I don't want the address bar to change during the .htaccess part of the redirect. (It's okay for…

aditya
- 1,978
- 3
- 17
- 22
19
votes
4 answers
Redirect multiple domains to one domain (with or without www before)
I have about 18 domains that need to be redirected to a new one. It has to work both with or without www prepended.
I've tried this:
RewriteEngine on
Rewritecond %{HTTP_HOST} !^www\.domain\.com
RewriteRule…

qwerty
- 5,166
- 17
- 56
- 77
18
votes
3 answers
PHP Page redirect problem - Cannot modify header information
I have a page that displays various elements even if the id it's calling from the database does not exist or was deleted (which throws up all sorts of ugly errors along with search engines continuing to list non-existent pages).
Can you modify the…

JoeW
- 578
- 1
- 10
- 29
18
votes
2 answers
Force browsers to forget cached redirects?
I inherited a domain that previously had a 301 redirect from the root ("/") to "/index.shtml"
I've removed the redirect and a different site on the domain, but people who visited the site in the past will have the redirect behavior cached in their…

DMack
- 871
- 2
- 9
- 21
16
votes
7 answers
Redirect in Next.js from uppercase to lowercase URL
I need to redirect visitors from /Contact to /contact.
When I am doing it as described in the docs I get an infinite redirect loop.
This is what I tried:
// next.config.js
async redirects() {
return [
{
source: '/Contact',
…

Yuval Levy
- 2,397
- 10
- 44
- 73
16
votes
3 answers
Set up 301 redirects from old classic ASP pages to new ASP.NET webforms pages
I've finished developing a website using ASP.NET Webforms and to finish it off I'm in the process of setting up some 301 redirects to ensure the old site's links are redirected properly.
However, the old website was written in classic ASP. What is…

Leah
- 2,547
- 5
- 23
- 28
15
votes
1 answer
PHP 301 Redirect, Impossible?
I have been trying to do a proper 301 redirect and have failed to do so. No matter what i try, its always a 302 redirect.
Returns a 302:
http_redirect("urlgoeshere", '', false, HTTP_REDIRECT_PERM)
Returns a 302:
header("HTTP/1.1 301 Moved…

brant
- 537
- 3
- 7
- 17
15
votes
3 answers
nginx using OR set at regex for the map
I'm trying to write a map for my website and it's working great:
map $request_uri $redirect_uri {
/en/oldname /en/newname;
/de/oldname /de/newname;
/fr/oldname /fr/newname;
}
until I try to implement some regex, something like…

Mike
- 1,979
- 2
- 16
- 29