D
D
Dr_Death2012-12-27 13:27:15
PHP
Dr_Death, 2012-12-27 13:27:15

Mod_rewrite and file not exist?

Error.log periodically contains entries like this:

File does not exist: /*server_path*/*domain*/tags, referer: http://*domain*/tags/*tag*/

They fall in packs in a couple of seconds from one address. In .htaccess mod_rewrite is written and works correctly
RewriteRule ^tags$ /$0/ [L,R=301]
RewriteRule ^tags/$ /tags.php [L]
. everything works fine with hands http://*domain*/tags -> http://*domain*/tags/
It is not clear how it gets through rewrite, and judging by the series in one second, it is clearly not a “manual” request. As if some kind of tricky requests that fly past rewrite and look for the folder directly. You can't repeat yourself.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
rasstroen, 2012-12-27
@rasstroen

And without the L modifier in the first RewriteRule will work? In theory, L stops the processing of rules, and you need the second one right away

R
rasstroen, 2012-12-27
@rasstroen

Maybe some urls do not fall under the rules, you can test the config here martinmelin.se/rewrite-rule-tester/ , entering these same referers, and see if there is one for which no rule will be executed

E
elgordo, 2012-12-27
@elgordo

I want to add that I once had a case when I spent 3 hours on a problem with mod_rewrite: the rule did not work, and then it turned out that there was another rule above it that worked before. Even for this, I downloaded a regular expression tester. Those. I was looking for the error in the wrong place. :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question