Mobile app version of vmapp.org
Login or Join
Gail5422790

: Edit: Fixed an error! This is the theory: RewriteEngine on RewriteCond %{HTTP_HOST} mom.com$ [NC] RewriteRule ^mom/ - [R=404,L] On some versions, if the above doesn't work, you can do this ugly

@Gail5422790

Edit: Fixed an error!

This is the theory:

RewriteEngine on
RewriteCond %{HTTP_HOST} mom.com$ [NC]
RewriteRule ^mom/ - [R=404,L]


On some versions, if the above doesn't work, you can do this ugly trick

RewriteEngine on
RewriteCond %{HTTP_HOST} mom.com$ [NC]
RewriteRule ^mom/ /someurlthatdoesntexist [L]


If you're fine with a 403 forbidden instead of a 404 not fund, you can use the F option.

RewriteEngine on
RewriteCond %{HTTP_HOST} mom.com$ [NC]
RewriteRule ^mom/ - [F,L]


However, there's one more thing to consider. .htaccess files are scanned from the top level and down, so if mom.com has any .htaccess files, they will take precedence. What you can do then, is the add the following to the .htaccess files in mom.com. This should be at the top of the files (right after RewriteEngine On).

RewriteEngine on
RewriteCond %{HTTP_HOST} !mom.com$ [NC]
RewriteRule . - [R=404,L]


Note the added !, which means match if the domain is not mom.com. Also note the . which means "catch all".

Replace - [R=404,L] with any of the other patterns as needed.

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Gail5422790

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme