Dragen Posted January 28, 2008 Share Posted January 28, 2008 Could someone tell me why this mod rewrite doesn't work: RewriteCond %{REQUEST_FILENAME} !^scripts/ RewriteRule ^(.*)\.js$ scripts/$1.js [NC,L] when this one does: RewriteCond %{REQUEST_FILENAME} !scripts/ RewriteRule ^(.*)\.js$ scripts/$1.js [NC,L] notice on the second one I remove the start-of-string thing '^', on the request filename. For the some reason the top one seems to just loop, thinking that even after the rewrite it doesn't start with scripts/. any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/88208-it-works-without-but-not-with-it/ Share on other sites More sharing options...
madmax Posted January 29, 2008 Share Posted January 29, 2008 Probably an automatic backslash append issue? / ??? !^scripts forcibly excludes cases where it has been rewritten to "/scripts..." if in root - the 2nd example would surely make a substring match?. Does this loop only in root or in subdirs? I've had this sort of thing before and the only way I've fixed it is by watching the rewrite logs in real time as there are more fixups going off in mod_rewrite than immediately apparent. Quote Link to comment https://forums.phpfreaks.com/topic/88208-it-works-without-but-not-with-it/#findComment-452238 Share on other sites More sharing options...
Dragen Posted January 29, 2008 Author Share Posted January 29, 2008 !^scripts forcibly excludes cases where it has been rewritten to "/scripts..." if in root ah, that's probably it. I guess to fix it I could change it to: !^(/)?scripts But it's working fine without anyway. Quote Link to comment https://forums.phpfreaks.com/topic/88208-it-works-without-but-not-with-it/#findComment-452276 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.