How to redirect sub-domains to main domain name?

How to redirect sub-domains to main domain name?

It is very easy to redirect sub-domains (e.g of a website to its main domain name (i.e. with the help of HTACCESS mode. You need Apache web server with mode rewrite enabled.

Search Engine Optimization professionals also use this kind of htaccess redirect to keep web surfer’s stay on the main domain rather than showing them 404 Page not found error.

Put this 4 lines of code as .htaccess file in sub-domain folders

RewriteEngine on
RewriteCond % !^www\.example\.com
RewriteRule ^(.*)$$1 [R=permanent,L]

Try it and enjoy.

Author: Param Lowe

SixthSense India ! Q. What is sixthsense? A. Sixth Sense is evolved or developed sensory power of mind. I am the real living example of SixthSense in humans. Wanna learn how to develop sixth sense? Join Param Lowe's online webcast starting April 2012. The fee of joining is USD 9045.00. send email to

Leave a Reply

Your email address will not be published. Required fields are marked *