Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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} ^site1.org$ [OR]  
RewriteCond %{HTTP_HOST} ^www.site1.org$  
RewriteRule ^/?$ "/site1.org\/" [R=301,L]  

directory structure

/public_html/site1.org/welcome.html

if i typed site1.org redirection works perfect but the URL will be http://site1.org/site1.org/welcome.html instead of http://site1.org/welcome.html

and the URL will be SEO Friendly

share|improve this question
add comment

3 Answers 3

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} ^site1.org$ [OR]  
RewriteCond %{HTTP_HOST} ^www.site1.org$  
RewriteRule ^/(.*)$ /site1.org/$1 [QSA,PT,L]  
share|improve this answer
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.