Home Advanced Code Redirect Old Domain To New Domain & Other Tricks

Redirect Old Domain To New Domain & Other Tricks

E-mail Print PDF

The best way to redirect an old web site to the new web site and keep the same search engine rankings is to use the permanent 301 redirect by creating an .htaccess file and adding some snips of code.

When a visitor/search engine requests a web page, your web server checks for a .htaccess file. Using the code included in the .htaccess file, it will guide a visitor in the right direction.

To create an .htaccess file:

  • Open your notepad.
  • Insert your code and change "mydomain.com" to your own domain name
  • Click Edit-> Save As. Save as .htaccess (don't forget the period). Select "All Files" from the drop down menu below the box where you give your file a name when saving. Click ok once you save it to the folder you prefer it to reside until you upload it.
  • Upload to your root folder of your website.

If you already have an .htaccess file on your server then download it and add your code on a new line. Save. Upload and overwrite existing file.

To redirect ALL files on your domain use this in your .htaccess file if you are on a unix web server:

Code:
redirectMatch 301 ^(.*)$ http://www.domain.com
redirectMatch permanent ^(.*)$ http://www.domain.com
You can also use one of these in your .htaccess file:

Code:
redirect 301 /index.html http://www.domain.com/index.html
redirect permanent /index.html http://www.domain.com/index.html
redirectpermanent /index.html http://www.domain.com/index.html

This will redirect "index.html" to another domain using a 301-Moved permanently redirect.

If you wish to redirect your .html or .htm pages to .shtml pages because you are using Server Side Includes (SSI) add this code to your .htaccess file:

Code:
 AddType text/html .shtml
AddHandler server-parsed .shtml .html .htm
Options Indexes FollowSymLinks Includes
DirectoryIndex index.shtml index.html

 

 

Domain Names

Sample image .com .info
.mobi .net
.org .tv .us
.biz .ws .name
.am .at .be .cc .cn .de .eu
.fm .jobs .jp .ms .nu .nz
.tc .tw .uk .vg .ASIA .ME

Website Hosting

Sample image We're the affordable, reliable place to host your site. And unlike the competition, there's no set up fee and no annual commitment.

24/7 Support

Sample image Our highly trained, courteous support staff is waiting to help. We'll resolve any issue to your complete satisfaction.