HTTP 301

« Back to Glossary Index

HTTP 301 Examples
– Client request: GET /index.php HTTP/1.1Host:
– Server response: HTTP/1.1 301 Moved PermanentlyLocation:
– Using an .htaccess file to fix problems with non-existing files or directories: Redirect 301 /calendar.html /calendar/Redirect 301 /not_found.html /
– Example of using a .htaccess file to redirect a non-secure URL to a secure address without the leading www:
– RewriteEngine On
– RewriteCond %{HTTPS} off
– RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
– RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
– RewriteCond %{HTTPS} on
– RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
– RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
– RewriteEngine On
– RewriteCond %{SERVER_PORT} 80
– RewriteRule ^(.*)$$1 [R,L]
– Example of a custom directory redirect using an index.html file:
– meta http-equiv=refresh content=0; url=/
– a href=/Home/a

Using Programming Languages
– Example of using Perl for redirection: print redirect(;
– Example of using PHP redirect: ?phpheader(Location:, true, 301);exit;
– Example of redirecting using Express.js:
– app.all(/old/url, (req, res) = {res.redirect(301, /new/url);});

Caching Server
– Example of a simple nginx configuration for redirection:
– location /old/url {return 301 /new/url;}

Search Engines
– Both Bing and Google recommend using a 301 redirect to change the URL of a page in search engine results.
– The URL change should be permanent and not expected to change again soon.

Additional Information
– HTTP 301 is a status code used for permanent URL redirection.
– It is commonly used when a website’s URL structure changes or when a page is moved to a new location.
– The 301 redirect informs both users and search engines that the requested page has been permanently moved to a new location.
– It is important to use a 301 redirect instead of other types of redirects like 302 or meta refresh, as it ensures that search engines will update their indexes with the new URL.
– The examples provided showcase different methods of implementing a 301 redirect, including using .htaccess files, programming languages, caching servers, and recommended practices for search engine optimization.

HTTP 301 (Wikipedia)

HTTP 301 is the HTTP response status code for 301 Moved Permanently. It is used for permanent redirecting, meaning that links or records returning this response should be updated. The new URL should be provided in the Location field, included with the response. The 301 redirect is considered a best practice for upgrading users from HTTP to HTTPS.

RFC 2616 states that:

  • If a client has link-editing capabilities, it should update all references to the Request URL.
  • The response is cacheable unless indicated otherwise.
  • Unless the request method was HEAD, the entity should contain a small hypertext note with a hyperlink to the new URL(s).
  • If the 301 status code is received in response to a request of any type other than GET or HEAD, the client must ask the user before redirecting.
« Back to Glossary Index

Submit your RFP

We can't wait to read about your project. Use the form below to submit your RFP!

Gabrielle Buff
Gabrielle Buff

Just left us a 5 star review

Great customer service and was able to walk us through the various options available to us in a way that made sense. Would definitely recommend!

Stoute Web Solutions has been a valuable resource for our business. Their attention to detail, expertise, and willingness to help at a moment's notice make them an essential support system for us.

Paul and the team are very professional, courteous, and efficient. They always respond immediately even to my minute concerns. Also, their SEO consultation is superb. These are good people!

Paul Stoute & his team are top notch! You will not find a more honest, hard working group whose focus is the success of your business. If you’re ready to work with the best to create the best for your business, go Stoute Web Solutions; you’ll definitely be glad you did!

Wonderful people that understand our needs and make it happen!

Paul is the absolute best! Always there with solutions in high pressure situations. A steady hand; always there when needed; I would recommend Paul to anyone!

Vince Fogliani

The team over at Stoute web solutions set my business up with a fantastic new website, could not be happier

Steve Sacre

If You are looking for Website design & creativity look no further. Paul & his team are the epitome of excellence.Don't take my word just refer to my website ""that Stoute Web Solutions created.This should convince anyone that You have finally found Your perfect fit

Jamie Hill

Paul and the team at Stoute Web are amazing. They are super fast to answer questions. Super easy to work with, and knows their stuff. 10,000 stars.

Paul and the team from Stoute Web solutions are awesome to work with. They're super intuitive on what best suits your needs and the end product is even better. We will be using them exclusively for our web design and hosting.

Dean Eardley

Beautifully functional websites from professional, knowledgeable team.

Along with hosting most of my url's Paul's business has helped me with website development, graphic design and even a really cool back end database app! I highly recommend him as your 360 solution to making your business more visible in today's social media driven marketplace.

I hate dealing with domain/site hosts. After terrible service for over a decade from Dreamhost, I was desperate to find a new one. I was lucky enough to win...

Paul Stoute has been extremely helpful in helping me choose the best package to suite my needs. Any time I had a technical issue he was there to help me through it. Superb customer service at a great value. I would recommend his services to anyone that wants a hassle free and quality experience for their website needs.

Paul is the BEST! I am a current customer and happy to say he has never let me down. Always responds quickly and if he cant fix the issue right away, if available, he provides you a temporary work around while researching the correct fix! Thanks for being an honest and great company!!

Paul Stoute is absolutely wonderful. Paul always responds to my calls and emails right away. He is truly the backbone of my business. From my fantastic website to popping right up on Google when people search for me and designing my business cards, Paul has been there every step of the way. I would recommend this company to anyone.

I can't say enough great things about Green Tie Hosting. Paul was wonderful in helping me get my website up and running quickly. I have stayed with Green...