How To Redirect Your Site Using .htaccess

There're various kinds of different redirect operations you can do using .htaccess

301 (Permanent Redirect)

Redirect an entire site to a different URL on a permanent basis.
For example, to redirect all your site to newdomain.com

Redirect 301 / http://newdomain.com/

 

302 (Temporary Redirect)

Redirect an entire site to a different URL, but not on a permament basis (it's useful for maintenance and for SEO purposes)
For example, to redirect all your site to newdomain.com

Redirect 302 / http://newdomain.com/

 

Redirect an old file to a new file path

This is useful if you reorganize your site, changing the URL, paths and names of files, but want to keep all of your linking in, redirecting the visitor directly to the new path.
You can have also hundreds of these redirects command in your .htaccess, so it amy be useful also if you changed your site from old, useless file names to new, SEO friendly file names; being so, you'll need to insert a command row for each file to be redirected.

Redirect /olddirectory/oldfile.php http://mydomain.com/newdirectory/newfile.php
 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What do I need to do to put Flash on my website?

Flash is a client side feature - it runs on the user's computer, not on your web host. As long as...

What are private nameservers and how do I set them up?

Private nameservers are where your domain points to our nameservers so that your customers do not...

Static IP vs. Dynamic IP Address

A static IP address is one that remains fixed and never changes. The PC always sees the same...

Protecting Yourself Against Viruses & Data Loss

It is vital to ensure your computer is protected from viruses and trojans. As well as...

How to Upgrade perl?

Run the following command. cd /usr/local/src ; wget...