htaccess redirect site


There are a lot of reasons to redirect website from one to another, for example when you changed your main domain name and want all traffic to be redirected to your new website domain name.

Instead of using slow html meta redirect function, it is a good idea to send command to your server directly.

Here is the code for .htaccess file to send your visitors to another domain name:

RewriteEngine On
RewriteRule ^(.*)$ http://www.htaccessfile.com/$1 [R=301,L]

Where http://www.htaccessfile.com is desired url you want to send traffic to.

If you want redirect to be permanent, you can use this command :

Redirect permanent / http://www.domain.com/

  1. No comments yet.

Comments are closed.