I have a hosting account that has multiple domains pointed to the same folder. In this folder I have an htaccess file. I need to know how I can write rules for only specific domains, so if I wrote a rewrite rule for one domain pointed to the folder that rule wont be used for the other domains pointed to the folder. I tried the following but it doesnt work:
# Domain1.com Redirects
RewriteCond %{HTTP_HOST} ^domain1\.com [NC]
RewriteRule ^page1 /page1.php [L]
# Domain2.com Redirects
RewriteCond %{HTTP_HOST} ^domain2\.com [NC]
RewriteRule ^page2 /page2.php [L]
When I say it doesnt work, when I go to page2 from domain1.com, domain1.com/page2, then the page2 rewrite rule for domain2.com works. But I dont want it to work, I only want page2 rule to only work when someone comes to the site under domain2.com. Any suggestions?
Try this: