Forum Moderators: phranque
[mysite.com...]
To rewrite to this:
[mysite.com...]
The part of the URL that comes after 'login' is a filepath that has been URL encoded. This is necessary because the filepath might otherwise sometimes contain &, which will confuse the login.php script.
My rule:
RewriteRule ^login(.+)$ account/login.php?redirect=$1 [L]
This doesn't work at all, meaning the URL request is never even matched with the RegEx. I've tried using this with a URL that has not been encoded, i.e.:
[mysite.com...]
And it works. Is there some reason that encoded characters like %2F are not matched with (.+)?
Jim
RewriteCond %{THE_REQUEST} ^login(.+)$
RewriteRule .* account/login.php?redirect=%1 [L]
This still gets no match to the RegEx whatsoever. It seems odd to me that these rules aren't just failing to pass the proper info to backreferences, but failing to match the expression at all. Shouldn't (.+) at least match and attempt to redirect, regardless of whether the string contains %2F or '/'?
Anyway, maybe you can clue me in to what's going wrong with the condition/rule above?
GET /apache/3422069.htm HTTP/1.1
So obviously, your start-anchored RewriteCond pattern will never match.
I'd suggest:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /login([^\ ]+)\ HTTP/
RewriteRule ^login account/login.php?redirect=%1 [NE,L]
Here's the strange thing. I tried this very simple rule:
RewriteRule ^login account/login.php [L]
This will not even work. With this same URL:
[mysite.com...]
I still get no match at all. And yet with this:
[mysite.com...]
It works. How can the simple expression ^login not match the above URL just because it has the unicode following it?