Jump to content

it works without ^, but not with it..


Dragen

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/88208-it-works-without-but-not-with-it/
Share on other sites

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.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.