301 Redirect

What is a 301 Redirect?

A 301 redirect forwards you from one URL to another and with an HTTP status code of 301. The 301 response code designated this redirect as “Moved Permanently”. This is similar to forwarding your mail from your old home address to your new permanent home address.

Example 301 redirect

https://oldwebsite.com -> https://newwebsite.com

301 Redirect vs 308 Redirect

Both a 301 redirect and a 308 redirect forward the request to the new location. The primary difference is how it sends the request. If a request is sent to a URL using the POST method and it is 301 redirected to a new URL, then the request method changes from a POST to GET. In contrast, a 308 redirect will force the client to use the same request method on the new URL as it used on the original URL. This is extremely important if the URL was expecting a particular request method such as POST to handle the request properly.

Example issue using 301 Redirect

You have a script that processes the data sent from your forms located at myformresults.php which only accepts POST requests. This file is referenced by forms located on several pages and even external websites. If you move myformresults.php to /myformresults/ and used a 301 redirect, then all forms sending data to the old location will now fail. The request will get forwarded to the new location, but with a GET method request, thus not meeting the requirements. To fix this issue, use a 308 redirect instead.

Broken Redirect

When a redirect points to page that no longer exists, it serves an error 404.

Other Redirects Codes

  • 300 Multiple Choice
  • 302 Found
  • 303 See Other
  • 304 Not Modified
  • 305 Use Proxy
  • 306 unused
  • 307 Temporary Redirect
  • 308 Permanent Redirect

Notify me about new features:

upcoming free account access, charts & stats, historical data, API, etc.

* All fields required.
follow: Twitter

© 2008-2021 WhereGoes.com