There will come a time when you may decide to obtain a new domain name for your website or you may even want to delete some pages in your website or you may want to change the URL of a web page to a more SEO friendly one e.g rather than www.mysite.com/123.html to www.mysite.com/my-product.html. The problem is you have probably spent weeks, months even years building links to these pages and the second you change the url structures of these pages they disappear in to the “404 – Not Found” abyss and losing you your precious search engine positions.
Thankfully there is a way to make sure your SEO is not undone and that is by using 301 Redirects. A 301 redirect is the most efficient and Search Engine Friendly method for web page redirection. It’s not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it’s the safest option. The code “301″ is interpreted as “moved permanently”.
You will need access to your .htaccess file to modify or add the redirects to your pages. The .htaccess file is a control file that allows server configuration changes on a per-directory basis. It controls that directory and all of the sub-directories contained within. In most cases, this file will be placed in the root Web folder for your Web site. If there’s no .htaccess file present, create one.
- Open your .htaccess file in notepad
- In your .htaccess file on a new page add the line:
RedirectPermanent /old-file.html http://www.domain.com/new-file.html
Redirect 301 /old-file.html http://www.domain.com/new-file.html
But what if you have dozens of pages to redirect because you have changed the domain name; well this can be done by adding the below code to your .htaccess file:
Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
This would require that the old pages you have redirected have the same URL structure as the new URL.
- Save your .htaccess file and re-upload to the root directory.
- To test your changes load the old page in your browser and see if it is redirected to the new page.
If you are using a cPanel hosting account then you can make redirects in your account.
- Log into your cPanel, and look for “Redirects” under Site Management
- Put in the current directory into the first box
- Put the new directory in the second box
- Choose the type (temporary or permanent) temporary=302 and permanent=301
- Click “Add” and you’re done