301 Redirect

The 301 redirection is described in RFC2616: “The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs”.

Browsers automatically follow these redirections. They also display the new permanent address in the address bar.

In accordance with RFC2616, the same address pointed to by the redirection will eventually be saved in the browser favorites.

The standard recommends to use a 301 redirect when a page has been permanently moved to a new address.

301 Redirect and Search Engines

According to RFC2616, search engines should forget the redirecting address and save the address pointed to by the redirection as the preferred address.

When a page has been moved to a permanent new address, Google recommends to use a 301 redirect. But, strangely enough, the leading search engine often needs weeks or months to take this information into account in its search results.

301 Redirect Implemented in .htaccess File

Assuming the web server allows it, it is easy to implement a 301 redirect in .htaccess.

Moving a page
RedirectPermanent /old-file-name.html http://www.new-domain.com/new-directory/new-file-name.html

Moving a directory
RedirectPermanent /old-directory http://www.new-domain.com/new-directory

Moving an entire site
RedirectPermanent / http://www.new-domain.com/

301 Redirect Implemented in a Server Script

The script (typically a PHP, Perl or ASP program) will have to generate a 301 header.

Moving a page in PHP
header(“Status: 301 Moved Permanently”, false, 301);
header(“Location: http://www.new-domain.com/new-directory/new-file-name.html”);

Checking if a 301 Redirect Works

InternetOfficer has designed a free on-line tool to check the working of redirects. This new tool to check redirects analyses the HTTP-header and the page contents and identifies in seconds 301 and 302 redirects and HTML redirects (meta refresh).

14 Responses to “301 Redirect”

  1. Web Programmer says:

    I started a thread few days ago on the HTTP Error (status) codes at WebMasterWorld and I got some good replies that are worth reading related to your article. Not based on specs but on user experiences.


  2. David DeAngelo says:

    I would also like to add that 301 redirect in the .htaccess file can be implemented as follows:

    redirect 301 /old-file-name.html http://www.new-domain.com/new-directory/new-file-name.html

    Apart from this, we could also use rewrite (also sending a 301 status):

    RewriteEngine On
    RewriteRule ^olddir/(.*)$ http://www.new-domain.com/newdir/$1 [R=301,L]

  3. Deck Jamie says:

    is there a way to 301 redirect in iis only with ftp and without any access to the server admin.

  4. Jean-Luc says:

    You can put this code in the pages to be redirected:

    <%@ Language=VBScript %>
    Response.Status="301 Moved Permanently"
    Response.AddHeader "Location", "http://www.example.com/new_url"


    <script runat="server">
    private void Page_Load(object sender, System.EventArgs e)
    Response.Status = "301 Moved Permanently" ;
    Response.AddHeader("Location","http://www.example.com/new_url") ;


  5. Ong Gia says:

    Hi, the previous webmaster for a site I’m working on had a bunch of files named in French with accents. I renamed those in order to take them out. Unfortunately, google still manages to see the old pages and they lead to a 404 error.

    I’ve created a .htaccess file to redirect quite a few pages but I’m having some issues with those files in particular.

    i.e: I renamed a file previously named “série.pdf” to “serie.pdf”

    Google sees the “série.pdf” as something like this “S%C3%89RIE.pdf” and I think that is where the problem lies…

    My redirect line goes something like this:

    redirect 301 /images/brochures_fr/S%C3%89RIE.pdf

    Unfortunately, it doesn’t seem to work.

    If you could provide me with any input or suggestions, I’d greatly appreciate it.

    Thank you for your time.


    Ong Gia

  6. Jean-Luc says:

    Try this:
    redirect 301 /images/brochures_fr/SÉRIE.pdf

  7. Steve Penny says:

    The question sometimes arrises with clients “How permanent is a 301 permanent redirect?” Anotherwords, if at some future point, the client changes their mind for whatever reason, what are the consequences of changing a “permanent” redirect?

  8. Jean-Luc says:

    Let say you have a permanent redirect from A to B.

    As long as there are still links pointing to A, Googlebot will continue to crawl A from time to time. If, at some point, the redirect to B disappears or if it is replaced by another redirect, Google will know it as soon as A has been crawled. This means that after a transition period, B will lose the benefits from the redirect from A.

  9. khadem says:

    how to redirect a htm site to php dynamic site ?

  10. David says:

    thank you for this tip and the 301 checking tool this will come in useful

  11. Alan says:

    I am trying to use:
    ReDirect 301 /docs/file%20name%20with%20spaces.pdf

    but am having similar problems as Jean-Luc with his accent. How can I get around this as I believe the syntax for ReDirect does not permit quotes around the text.

  12. Jean-Luc says:

    Just use the quotes (they are permitted):
    ReDirect 301 "/docs/file name with spaces.pdf"

  13. Software Development Company says:

    Hello Thanks… It will help me lot

  14. JamesW says:

    I’m having a lot of trouble getting this to work. I want all of my http://signsmanufacturing.com queries to go to http://www.signsmanufacturing.com

    I’ve tried the following, but it doesn’t work:

    RedirectPermanent http://signsmanufacturing.com http://www.signsmanufacturing.com

    What gives?!?


Leave a Reply

You must be logged in to post a comment.