Reputation: 53
I have 2 domains going to a vhost
example.com thisismyexample.com << this is an alias of the first one. It has got his own vhosts which is a symbolic link of the first one.
I need different behavior for each one so I'd like to redirect as:
if request comes for example.com -> example.com/index.php
if request comes for thisismyexample.com -> thisismyexample.com/admin.php
Both files index.php and admin.php are on the same directory which is my document root. At the moment there's a REQUEST_FILENAME
rule and everything goes to index.php
I would try with redirectmatch but would like some opinions first
RedirectMatch ^example.com/$ http://example.com/index.php
RedirectMatch ^thisismyexample.com/$ http://thisismyexample.com/admin.php
Is this possible using htacces? If so, how would it be?
Upvotes: 0
Views: 54
Reputation: 22831
Use a RewriteRule
with a RewriteCond
that checks the host-header:
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^ http://%{HTTP_HOST}/index.php [R,L]
RewriteCond %{HTTP_HOST} ^thisismyexample.com$
RewriteRule ^ http://%{HTTP_HOST}/admin.php [R,L]
Upvotes: 1