The .htaccess file is a system configuration file which generally is located in the same location as your index file. This website will explain how to create a .htaccess file to redirect your site or site content. Please not that .htaccess configuration will not redirect any emails for your domains. If you wish to redirect e-mail you will need to change the DNS settings of your domain.
.htaccess is a very powerful file. Even the slightest syntax error (like a missing space) can result in your content not displaying correctly or at all. Please play responsibily. Always take backups.
Any line with a # (hash, number) sign in the beginning is a comment. It will have no affect on your configuration.
This allows you to redirect your entire website to any other domain permanently.
If you wish to redirect your files parmenently you can do it like so:
This allows you to redirect your entire website to any other domain temporarily.
This allows you to redirect your index.html file to a specific subfolder.
Use this redirection if your files or paths have changed. By doing this you will make sure that your traffic is not lost in your 404 pages. If you have purchased an expired domain that already has some pages indexed within search engines, this would be a great way of redirecing the traffic to your newly created pages.
Use this to provide Specific Index Page of your website (Set the default handler)
Google can treat a www and non-www URL as totally different pages. Make sure that your htaccess file has only one of those. If you have Google Webmaster Tools (GWT) setup for your domain, please make sure that this rewrite matches the setup of your domain in GWT.
www to non-www
non-www to www
If you have a self-hosted version of Wordpress it is very important to protect your login page. You can do this by allowing only certain IPs to access this directory. Create a .htaccess file and place it in your wp-admin directory: