.htaccess redirect by domain name

n64man120

2[H]4U
Joined
Jan 11, 2004
Messages
3,498
I have a website accessible from domainA.com/domainB and from domainB.com, both point to the same folder.

Is there anyway using an .htaccess file to selectively look at the .com part of the name, and send back a 404 based on it? I'm not familiar enough with them to know, but I suspect this is the ideal way to go about it.
 
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([\w\d-]+)(\.com) $1_404.html [NC]

That should redirect domain*.com to domain*_404.html
 
Back
Top