Forum Moderators: phranque
My understanding (and please correct me if I'm wrong), is that if the directory structure doesn't exist in the filesystem which Apache looks at but is dynamically created then mod rewrite won't work.
Thanks in advance for any useful advise.
<Directory /docroot/>
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^192\.168\.1\.1
#RedirectMatch ^friday.domain.co.uk$
RewriteRule .*? - [F]
</Directory>
The RedirectMatch is my main aim, so that if people come to that subdomain, I want them blocked except if they are coming from a specific ip range.
mod_rewrite code can be written to check for 'file exists' and 'directory exists,' and to take action conditionally based on those checks. But it will always execute unless some other module is interfering with it. It's possible that you may be seeing interference from content-negotiation/MultiViews, which I recommend disabling unless you actually use them.
Jim
The RewriteRule was taken from a book, to basically match any string and deny it from that address. It may still be wrong but I have to start somewhere when learning mod_rewrite ;)
I do use content-negotation for various media types. However I'm coming to the conclusion that mod_rewrite isn't the best way for me for access control.