lucy24 - 1:03 am on Jan 23, 2013 (gmt 0)
Overlapping last two (at least!) posts:
I changed the second rewrite rule to have $ at the end of the pattern. With this, there seems to be no effective rewriting or redirection at all.
In the pattern, $ is an anchor. It means that the text you're looking at must be the very last thing in the URL-- not counting query, if any.
Did you ever decide whether your URLs should or should not end in a slash? Since it isn't a "real" directory, you have to enforce a format; mod_dir won't do it for you. Or, uhm, am I thinking of another thread? There were two fairly similar questions side by side...
If your URL ends in a slash and the rewrite/redirect pattern doesn't, then the rule will only work if you leave off the anchor.
192.168.1.205 - - [21/Jan/2013:12:38:44 --0600] [192.168.1.106/sid#698560][rid#73ca98/initial] (1) [perdir F:/Websites/RepHunter/current/] pass through F:/Websites/RepHunter/current/manufacturers-sales-reps-register.php
192.168.1.205 - - [21/Jan/2013:12:38:44 --0600] [192.168.1.106/sid#698560][rid#73f400/initial/redir#1] (1) [perdir F:/Websites/RepHunter/current/] pass through F:/Websites/RepHunter/current/error404.php
Ouch. This is a logging level I don't read fluently, but this is the core of the problem, right? At this point your server is looking for a physical file called
which of course doesn't exist, because the newly redirected request is now supposed to get rewritten.
With opening anchors you can always cheat by leaving off both the ^ and the leading / and then you don't have to remember whether the / is supposed to be there or not. Then, once you've got everything else working, add the slash-plus-anchor combination so the rule will run faster in real life. Opening anchor means mod_rewrite may only have to look at one or two characters to see if the rule fails. Otherwise it has to read the whole thing.