HTTP 301 The Redirect Basics

42
60
2.1K followers

Hello,

Often we hear to use a redirect when a webpage is not reachable anymore or a URL is changed. But I thought it might be handy for a lot of people to list the basics of such a redirect.

$


First of all: When do you use a Redirect?

  • As default – this is the preferred method for every page redirection.
    (You can also use canonical URL’s but the 301 redirect is the preferred method.)

  • For pages that are permanently moved or replaced.

  • Domains that are permanently moved (acquisitions, rebranding, etc.).

  • 404 pages and expired content (when there is still relevant content or the page still exists).


Why?

The most important search engines are cracking down on websites that use sneaky redirects or point multiple domains to the same content, without using a proper redirect. The 301 permanent redirect is therefore also known as a search engine friendly redirect.


Where?

The best practice is to create the 301 redirect at the.htaccess file.
This file is located in the HttpDocs folder of your site, you can access this file easily thru an FTP client and edit the file as a text file.

To use the .htaccess file your website has to be on an Apache (Linux, Unix) based server. Here at WA this is the case, so for everybody with their site hosted on WA, this procedure can be applied.
If you use another hosting and you are unsure, then a simple header check will indicate your server type.

You can use this link to do this: http://tools.seobook.com/server-header-checker/

But you can also use your SEO plugin (I think the all in one has this possibility also), for Yoast you do it like this:
http://kb.yoast.com/article/305-how-to-edit-htacce...


How to setup a 301 Redirect

The basic code for redirecting is:
Redirect 301 old_location new_location

Redirect a single page:
Redirect 301 /oldpage.php http://www.yoursite.com/newpage.php
Redirect 301 /oldpage2.php http://www.yoursite.com/folder

You have moved your domain to another site / domain name:
Then you actually want to redirect the whole site, replace, of course, the previoussite and newsite values with the real values.
These 4 lines have to be added in the .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^previousSite\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.previousSite\.com$
RewriteRule ^(.*)$ "http\:\/\/newSite\.com\/$1" [R=301,
L]

That is about it for the basics, of course, a lot more can be said about this redirection method. But when you understand the above well, then you can go already a long way with this knowledge...

I hope you liked this piece of info... ;-)

Grtz,
Bert

42
60

Join FREE & Launch Your Business!

Exclusive Bonus - Offer Ends at Midnight Today

00

Hours

:

00

Minutes

:

00

Seconds

2,000 AI Credits Worth $10 USD

Build a Logo + Website That Attracts Customers

400 Credits

Discover Hot Niches with AI Market Research

100 Credits

Create SEO Content That Ranks & Converts

800 Credits

Find Affiliate Offers Up to $500/Sale

10 Credits

Access a Community of 2.9M+ Members

By continuing, you agree to our Terms of Service and Privacy Policy
No credit card required

Recent Comments

60

Thank you Bert, a very good piece of information!

1

You're very Welcome!

1

Thanks Bert. Do you know if you're penalized for not doing the redirect?

1

Penalized is a big word, but using a 301 is more SEO friendly than using a canonical... So, let's say: you will get a candy when you use a 301 and you will not get that candy when you use a canonical...
But you will not be severely penalized when you use a canonical...
;-)

Hope this helps...

My question. What if you don't redirect at all?

1

Then you will have a lot of 404 errors or your old pages and content will still be visable for the visitors if they are not redirected from it...

https://en.wikipedia.org/wiki/HTTP_404

Grtz,
Bert

Oh no I changed the title and the url. The old url won't redirect. I don't care now cause it's ranked 400 or something. Should I redirect these to the new url? Seems like a waste of time.

1

It is never wrong to do this.

Thank you Bert. This will be needed sooner or later.

1

And if extra questions, don't hesitate...

1

Thank you Bert this is great been a lot of questions about 301 directs lately

1

There you go... ;-)

1

Thanks Bert for the great clear information. Much appreciated. Cees

1

Thanks Cees...

1

Thanks Bert as redirects slow down page loading speeds so this is good to know

1

Then this is indeed a better solution, cause you mean the cannonicals I suppose?
(And also SEO is better with 301's)

1

Hey Bert! Sounds like good info to know so I've book marked it for when I can understand it! Which proves that if you are ingnorant, then I am super ignorant! For now!

2

:-)
Glad you like it.... ;-)

Good info to know Bert. I've bookmarked this in case I ever need it.

1

Thank you Marion!

1

Excellent work Bert! Keep up the good work! Thank you for all the work you put into this missive of information! Much appreciated!

1

WIth pleasure TA! ;-)

1

This is something I really want to learn, these editing code stuff, but so nervous to do so. Thanks Bert.

1

You can do this!
I am really sure that this is very simple for you, once you 've done it once, you will do it with your eyes closed... ;-)

Grtz,
Bert

1

See more comments

Join FREE & Launch Your Business!

Exclusive Bonus - Offer Ends at Midnight Today

00

Hours

:

00

Minutes

:

00

Seconds

2,000 AI Credits Worth $10 USD

Build a Logo + Website That Attracts Customers

400 Credits

Discover Hot Niches with AI Market Research

100 Credits

Create SEO Content That Ranks & Converts

800 Credits

Find Affiliate Offers Up to $500/Sale

10 Credits

Access a Community of 2.9M+ Members

By continuing, you agree to our Terms of Service and Privacy Policy
No credit card required

2.9M+

Members

190+

Countries Served

20+

Years Online

50K+

Success Stories

The world's most successful affiliate marketing training platform. Join 2.9M+ entrepreneurs building their online business with expert training, tools, and support.

© 2005-2025 Wealthy Affiliate
All rights reserved worldwide.

🔒 Trusted by Millions Worldwide

Since 2005, Wealthy Affiliate has been the go-to platform for entrepreneurs looking to build successful online businesses. With industry-leading security, 99.9% uptime, and a proven track record of success, you're in safe hands.