views:

32

answers:

1

I have 8 domainnames that point to the same www-root. If the main domain is accessed, you are pointed to index.php, and from there on, the URL's are like: index.php?p=contact etc. If, however, you access one of the other 7 domains, that point to different units, you are initially pointed to: index_local.php, and from there on it goes like: index_local.php?p=contact etc.

As you may see these URL's are very ugly, can I use mod_rewrite in this scenario to make it so that index.php AND index_local.php never show up in URL? Is there any better way to do this than the way I'm pointing the user now with multiple domains in the same www-root?

+1  A: 

Something like this should help hide the index* URLs:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond    %{HTTP_HOST}    ^domainname1.com
RewriteRule    ^/(.*)$    index.php?p=$1 [L]

RewriteRule    ^/(.*)$    index_local.php?p=$1 [L]
</IfModule>

There are other ways to do this cleanly, if your willing to change some code, but this should work with the code you have.

Sandeep Shetty