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
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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.