How to redirect your site using htaccess

It is sometimes necessary to redirect an entire domain to another destination domain . This can be done with a redirect htaccess file placed in the root of your web folder. If the file aready exists you can just edit it , if not you will need to create it.

Open your favourite text editor and enter the following txt at the top replacing www.destinationdomain.com with your destination domain.

#This allows you to redirect your entire website to any other domain
Redirect 301 / http://destinationdomain.com/
# This allows you to redirect index.html to a specific subfolder
Redirect /index.html http://destinationdomain.com/newdirectory/
# Redirect old file path to new file path
Redirect /olddirectory/oldfile.html http://destinationdomain.com/newdirectory/newfile.html
# Provide Specific Index Page (Set the default handler)
DirectoryIndex index.html

Save this file as htaccess.txt

Using an FTP client upload this file to the root web folder of your domain you are creating the redirect for. Rename the htaccess.txt file to .htaccess (important) and make sure the files permissions are set to 644

Now visitors who go to www.sourcedomain.com will be auto redirected to www.destinationdomain.com

  • 71 Users Found This Useful
Was this answer helpful?

Related Articles

How Do I Upload Files Via FTP

First you need to get an FTP client. There are lots of free clients on the web. Once you've...

I have a website, where/how do I upload my website files?

If you have created a website and wish to upload it to your webspace, you must upload it into...

Installing Wordpress or an application from the Application Vault returns an error.

You might find when installing an application from the Application Vault for example Wordpress,...

Migrate Wordpress to a new domain name

Changing Your WordPress Domain Name While Moving Your Site to a New Location There are different...

How do I force HTTPS for my website so it uses my SSL certificate

If you have purchased an SSL certificate and you want to start using it you will need to...