Standart Posted February 19, 2007 Share Posted February 19, 2007 Hi, I'm pretty new to RewriteRules. Here's my scenario: In a .htaccess file I want to redirect (301) url path "old" to url path "new". Like this: RewriteRule ^old$ /new [R=permanent] Additionally I want to rewrite url path "new" to the existing file "old" (no external redirect): RewriteRule ^new$ old These two rules work perfectly unless I try to use them both. I tried to use the L-flag which stops the rewrite process according to the apache docs: RewriteRule ^new$ old [L] RewriteRule ^old$ /new [L,R=permanent] Now if I request http://mydomain.net/old or http://mydomain.net/new I get a 301 to the location http://mydomain.net/new and in an infinite loop. I understand that but as I understood the L-flag I could stop this loop being the last rewrite statement to be processed. I assumed that the redirect rule would initiate a new request to "new" and that request would be rewritten to "old" without invoking the redirect again. Of course I could rename my original file but I'm interested in how the L-flag really works. Anyone an explanation? Link to comment https://forums.phpfreaks.com/topic/39163-end-rewrite-process-by-l-flag/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.