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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.