Leosquarez – Website Design and Development

Website Design and Development

If you are going to change the name or move the location of some pages or directories, it is very important to remember that some users will still try to access the old link/url.

To make sure the users will not land at a 404 error page you need to redirect them to the new link/url.

In html or php websites you can redirect users from one url to another using the 301 redirect technique.

The 301 redirect needs be to added on the .htaccess file as follows:

#Moving a page
RedirectPermanent /old-page-name.html http://www.new-domain.com/new-directory/new-page-name.html

#Moving a directory
RedirectPermanent /old-directory http://www.new-domain.com/new-directory
# the name /old-directory is all the path of the directory after the domain:
# for example if your old path was www.domain.com/directory/old-sub-directory and you want change the subdirectory your code will be like:

RedirectPermanent /directory/old-sub-directory http://www.new-domain.com/directory/new-sub-directory

#Moving an entire site
RedirectPermanent / http://www.new-domain.com/

1270093585_stock_folder-move

Popularity: 3% [?]

Posted by leosquarez On April - 1 - 2010 Web Development

One Response to “Redirect 301 htaccess – Moving a page, directory or domain”

  1. Love never hurts; it’s the loss or the

Leave a Reply

Subscribe here

VIDEO

TAG CLOUD