hi all i have this question as my rewrite rule is shown below. But everytime when i am using this code the js file wont work.
RewriteRule ^([^thumb].*\.[jJ].*)$ /images/files/w.php?i=$1
Can anyone tell me where went wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In order to handle more than just jpgs you can change it to be the following:
This will covers
jpg,jpeg,pngandgiffile extensions while not matching javascript files.Note:
[^thumb].*won’t match any file names starting witht,h,u,m, orb, (e.g.,test.jpg,home.jpg,umbrella.jpg,monster.jpg, orbeach.jpgwon’t match) not just files starting withthumb..., for the whole word,thumb, you need a negative lookahead(?!regex). To make the rule not match files starting with “thumb” this is what the rule should look like:One last problem the rule handles text after the file extension which I assume means that you may have urls that look like:
http://www.example.com/test.png?foo=a&b=bazYour rule will create a rewrite that ends up looking like
http://www.example.com/images/files/w.php?i=test.png?a=foo&b=bazWhich is not a valid url as there are now two
?s in the query string. To fix this I’d go with the following regex.This regexp rule will result in a properly formed url
http://www.example.com/images/files/w.php?i=test.png&a=foo&b=baz