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
1547
votes
35 answers
How do I make a redirect in PHP?
Is it possible to redirect a user to a different page through the use of PHP?
Say the user goes to www.example.com/page.php and I want to redirect them to www.example.com/index.php, how would I do so without the use of a meta refresh? Is it…

Sam
- 18,417
- 5
- 22
- 11
554
votes
25 answers
Generic htaccess redirect www to non-www
I would like to redirect www.example.com to example.com. The following htaccess code makes this happen:
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
But, is there a way to do this in a generic…

deepwell
- 20,195
- 10
- 33
- 39
511
votes
18 answers
How long do browsers cache HTTP 301s?
I am debugging a problem with a HTTP 301 Permanent Redirect. After a quick test, it seems that Safari clears its cache of 301s when it is restarted, but Firefox does not.
When do IE, Chrome, Firefox and Safari clear their cache of 301s?
For example,…

Liam
- 19,819
- 24
- 83
- 123
441
votes
8 answers
HTTP redirect: 301 (permanent) vs. 302 (temporary)
Is the client supposed to behave differently? How?

flybywire
- 261,858
- 191
- 397
- 503
259
votes
2 answers
What's the difference between HTTP 301 and 308 status codes?
What's the difference between HTTP 301 and 308 status codes?
301 (Moved Permanently): This and all future requests should be directed to the given URI.
308 (Permanent Redirect): The request and all future requests should be repeated using another…

Alexander Drobyshevsky
- 3,907
- 2
- 20
- 17
79
votes
8 answers
What is the best approach for redirection of old pages in Jekyll and GitHub Pages?
I have blog on github pages - jekyll
What is the best way to solve url strategy migration?
I found the best practice in common is create htaccess like so
Redirect 301 /programovani/2010/04/git-co-to-je-a-co-s-tim/…

Mailo Světel
- 24,002
- 5
- 30
- 40
68
votes
5 answers
PHP header redirect 301 - what are the implications?
I have example.com. If the user is logged in, it should load automatically example.com/option-X where X is a predefined choice of the user.
So, I do this at the top of index.php:
header("Location: /option-X");
But, if the user is not logged in, I…

Andres SK
- 10,779
- 25
- 90
- 152
68
votes
6 answers
How long does Chrome remember a 301 redirect?
I have a new author site that I want to make available from a domain that I had previously used Apache rewriting to bounce traffic to my Amazon site, [R=301,L], which I want to serve up as my own site. I also have a new domain for the interim at…

Christos Hayward
- 5,777
- 17
- 58
- 113
58
votes
7 answers
.htaccess 301 redirect of single page
After a site redesign, I've got a couple of pages that need to be redirected. Everything is staying on the same domain, just a couple of things have been reorganised and/or renamed. They are of the form:
/contact.php
is now:
/contact-us.php
Using…

Dan
- 916
- 2
- 7
- 10
39
votes
4 answers
Apache 301 Redirect and preserving post data
I have implemented SEO URLs using Apache 301 redirects to a 'redirect.cfm' in the root of the website which handles all URL building and content delivering.
Post data is lost during a 301 redirect.
Unable to find a solution so far, have tried…

Daniel Cook
- 1,033
- 1
- 9
- 19
37
votes
5 answers
Are 301 redirects possible using javascript or jQuery?
I'm running Apache 2.0 and I'm just wondering if it is possible to make a 301 redirect using JavaScript or jQuery.
I have an tag with href to a specified location and I'm asked to make a 301 redirect when I click that link.
This is for SEO…

Caleb Doucet
- 1,751
- 2
- 14
- 29
35
votes
2 answers
Redirecting 404 error with .htaccess via 301 for SEO etc
I couldn't find a straight answer to my question and need to know it from the real experts.
I had a website which urls were generated by Joomla. I believe that tons of urls are around in the search engines and I really don't know which of them all.…

Chris
- 1,919
- 6
- 34
- 60
33
votes
6 answers
Nginx Remove WWW And Respond To Both
I have the following nginx configuration fragment:
server {
listen 80;
server_name mydomain.io;
root /srv/www/domains/mydomain.io;
index index.html index.php;
access_log /var/log/nginx/domains/mydomain.io/access.log;
error_log…

Justin
- 42,716
- 77
- 201
- 296
31
votes
3 answers
Does 301 redirect always preserve referrer?
I want to know whether 301 redirect always preserve referrer.
I make a page called "gotoorig_https.html" which contains a hyperlink to a page "orig_https.asp".
"orig_https.asp" will 301 redirect to "dest.html" which shows the document.referrer.
In…

Billy
- 15,516
- 28
- 70
- 101
26
votes
1 answer
301 Redirect one domain to another using web.config
I have multiple domains pointing to one hosting location.
I wish to establish one of the domains as my main domain and therefore I wish to perform a 301 redirect to this main domain whenever a user accesses my site from a secondary domain.
For…

jezzipin
- 4,110
- 14
- 50
- 94