Web Analytics Made Easy - Statcounter
Tuesday , 31 January 2023
Home > htaccess > How to setup a 301 Redirect

How to setup a 301 Redirect

How to setup a 301 Redirect

A 301 HTTP response status code is a way of telling search engines that a page, pages, directory or entire website has been permanently moved to another place on the web.

Htacess Redirect

This is very useful if you have changed the structure of your websites url’s or if you have moved domain. You can also redirect your entire site.

Whereas a 301 code tells search engines that something has been permanently moved, a 302 code tells search engines that something has been temporarily moved. This is useful if you only want to redirect a page for a short period of time. To do a 302 redirect simply change the 301 part to 302.

You can also use 303, which is means ‘seeother’ and the page has been replaced by something else. Again, to do this simply substitute 301 with 303 in the tutorials below.

How to setup a 301 Redirect

The basic code for redirecting is :

Redirect 301 old_location new_location

The old location of the file has to be the absolute path from the root of your server. The new location should use http.

Htacess to Redirect Pages

Saving your page’s ranking, search position and it’s indexed age are important to maintaining your sites traffic. Moving one or more files into a new named folder can result in better website organization or to simplify your sites categories but if you don’t redirect the crawlers to index your new page(s) then your new pages will be sent back in the searches like a newly created webpage pages.

Htacess SEO Redirect

Picking a strong folder name or page name based on top searched keywords is one way to SEO improve your keyword focus and page ranking.

So for example, if you want to move a file called productreview.html from the root of your site to a subdirectory called products you would use :

Redirect 301 /productreview.html http://www.yoursite.com/products/productreview.html

How to setup a 301 Redirect

If you have moved your domain to another site you may want to redirect the whole site.

To so this you simply use the following code:

Redirect 301 / http://www.newdomainname.com/

About Whendy

Whendy Blog mengumpulkan beberapa Tutorial Website, PHP, AngularJS, JQuery, Laravel, Codeigniter dan lain-lain. ( jika sempat ) :)

Check Also

How to Stop Directory Listing

How to Stop Directory Listing – If you have a lot of files in a ...

One comment

  1. Helolo There. I found your weblog using msn. That is a really neatly
    written article. I’ll make sure to bookmark it and come back to read more of your helpful information. Thank you for thee post.
    I’ll certainly comeback.

Leave a Reply

Your email address will not be published. Required fields are marked *