I have a .htaccess file 开发者_开发问答with (only) the following lines:
RewriteEngine on
RewriteRule (.*)/[^/]+\.txt$ a.html [L]
What this does is to redirect every URL one directory below the current and ending with .txt
.
I have two additional files (each containing one line of text for identification):
- a.html
- existent
I have no file named nonexistent.
- When I request
nonexistent/some.txt
I get the contents ofa.html
, as EXPECTED - When I request
existent/some.txt
I get the contents ofa.html
, as EXPECTED - When I request
a.html/some.txt
I get a 404 error which was UNEXPECTED
Nothe that I don't have dontent-negotiation enabled. To prove this: existent/some.html
return 404.
I am totally baffled by this behavior, I'd like to know what principle is working here.
Perhaps add in (untested):
RewriteCond ${REQUEST_URI} !/?a\.html
精彩评论