Actual test case
Sorry
my bad
Now I remembered the situation.
I have directory say "abc" in document root
Normally if I leave it handle by web server
visitor can access it with
http://www.example.com/abc/...
but I don't want that
this is what I want
http://www.example.com/!/...
Basically I can just rename directory "abc" to "!" but
I have good reason to leave it as "abc" in back-end.
thus I use rewrite module to handle this
first I just rewrite /!/ to /abc/ which pretty simple
Code:
<IfModule rewrite_module>
RewriteEngine On
RewriteRule ^(\/?)\!\/(.*) $1abc/$2 [L]
</IfModule>
Now for security reason I don't want anyone access that content via
http://www.example.com/abc/...
then I add some more rewrite rule to make some kind of null route from that URI
this is when things mess up
Code:
<IfModule rewrite_module>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^\/abc\/.* [NC]
RewriteRule .* /null.txt [L]
RewriteRule ^(\/?)\!\/(.*) $1abc/$2 [L]
</IfModule>
The combination of 2 rewrite rules is not what I expect
LSWS behave like this:
- when people access
http://www.example.com/abc/...
it drop the request with some dummy file which is correct as my expectation.
- when people access
http://www.example.com/!/...
it also redirect to the dummy file.
this code is same for Apache.
However in Apache
I just put
RewriteCond %{ENV:REDIRECT_STATUS} ^$
on each rule
but as you know I can't do that on LSWS.
Now I have to handle the request with PHP or other server side script which is heavyweight and not a good solution.
Probably it may have some other solution but I can't think of good one.