Friday 27 September 2013

301 redirect using httpd.conf

This is how to do a 301 redirect if you want to divert traffic from one domain to another.

It is best to use a 301 redirect which is a permanent redirect code.

Edit your httpd.conf file which should be located /etc/httpd/conf/httpd.conf

Then just add this code to the end of the file (don't forget to change the domains to your own!)

<VirtualHost *:80>
   ServerName www.domaintoredirect.com
   ServerAlias domaintoredirect.com
   RewriteEngine on
   RewriteRule ^/(.*) http://www.DomainToPointTo.net/$1 [L,R=301]
</VirtualHost>


Don't forget to restart the web server

/etc/init.d/httpd restart

Job done! Your domain should now be redirecting.

No comments:

Post a Comment