HTTP 301 Moved Permanently

The HTTP 301 status code indicates that the content has been moved. Learn how to implement it in this tutorial.

1303 views

Edited: 2019-11-23 06:33

The HTTP 301 Moved Permanently is sent by servers whenever a requested resource has been permanently moved. The 301 HTTP status code is normally sent together with a HTTP Location Header, containing the URL of the new location of the resource – unless the request was a HEAD, in which case the location can be omitted.

It is important to properly redirect your pages when they move, so that search engines will pass on the rank of the old pages to the new pages – if this is not possible, for whatever reason, you might want to use a meta tag redirect instead.

How the 301 Moved Permanently look

A GET request for a resource might look like the below:

GET /old-page.html HTTP/1.1
host: beamtic.com

A server response containing a 301 response code, could look very much like the below example:

HTTP/1.1 301 Moved Permanently
Location: http://beamtic.com/new-page

See also

  1. PHP Redirect – How to perform redirects with PHP
  2. Meta Tag Redirect – How to do Client-sided Redirects.

Tell us what you think:

  1. An in-dept look at the use of headings (h1-h6) and sections in HTML pages.
  2. Pagination can be a confusing thing to get right both practically and programmatically. I have put a lot of thought into this subject, and here I am giving you a few of the ideas I have been working with.
  3. The best way to deal with a trailing question mark is probably just to make it a bad request, because it is a very odd thing to find in a request URL.
  4. How to optimize image-loading and automatically include width and height attributes on img elements with PHP.
  5. HTTP headers are not case-sensitive, so we are free to convert them to all-lowercase in our applications.

More in: Web development