Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

point multiple domain to single web hosting account using htaccess

i have used the following .htaccess file in my public_html directory

RewriteEngine on  
RewriteCond %{HTTP_HOST} ^$ [OR]  
RewriteCond %{HTTP_HOST} ^$  
RewriteRule ^/?$ "/\/" [R=301,L]  

directory structure


if i typed redirection works perfect but the URL will be instead of

and the URL will be SEO Friendly

share|improve this question

4 Answers 4

up vote 0 down vote accepted

This is tricky to do without control of the main Apache config, since Name-based Virtual Hosts are the proper way to do it.

You could probably improve your rewrite solution thus:

RewriteEngine on  
RewriteCond %{HTTP_HOST} ^$ [OR]  
RewriteCond %{HTTP_HOST} ^$  
RewriteRule ^/(.*)$ /$1 [QSA,PT,L]  
share|improve this answer

The .htaccess you have written sends a 301 redirect to the browser, which then re-request the page from the url it was directed to. The .htaccess does not serve different content based on the incoming domain.

It would be best to use a PHP script, for example, to detect the domain and send content based on that.

share|improve this answer

This is not point multiple domain to single web hosting account using htaccess. Here you are doing url redirection. Please phrase your question properly.

share|improve this answer
in my cpanel setup, if i add a new domain pointing this hosting it will create the .htaccess file mentioned above – JKS Feb 25 '11 at 5:20

Mine I have it like this...

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.