Hi,

We are running a Durpal multi-site install and as such we have one .htaccess file governing all domains. As such I need to be domain specific for 404

I would like to 404 a specific URL www.example-A.com/widget/

but not

www.example-B.com/widget/

I have tried
ErrorDocument 404 www.example-A.com/widget/

But nothing happens and page loads fine which is not good as /widget/ is associated with site
www.example-B.com/widget/
leading to major duplication issues.

Thanks for any feedback,

D

Comments

dutchie76’s picture

this should work but it does not...

Apache 1.x or 2.x:

# If widget/ URL-path requested from non-example-B.com host, rewrite to non-existent filepath to force 404 response
RewriteCond %{HTTP_HOST} !^example-B\.com
RewriteRule ^widget/ /filepath-which-is-known-not-to-exist.lmth [L]

Apache 2.x:

# If widget/ URL-path requested from non-example-B.com host, force 404 response
RewriteCond %{HTTP_HOST} !^example-B\.com
RewriteRule ^widget/ - [R=404,L]

so i tried...

Adding
RewriteCond %{HTTP_HOST} ^example-B\.com
as the first RewriteCond in the WP code would prevent any but example-B requests from invoking WP.

but thus also did not work and it should.

There must be something else which has an effect which overrides htaccess rules within a Drupal environment.

Anyone know what this might be?

Cheers