$1, used in the RewriteCond, is not set. It comes from the RewriteRule below the RewriteCond. Try
- Code: Select all
RewriteRule (.*) /index.php?$1 [PT]
RewriteCond $1 \.jpg$
RewriteRule ^(.+)$ - [E=jpg:1]
It is pointless anyway as you could just do the test in the RewriteRule
- Code: Select all
RewriteRule (.*) /index.php?$1 [PT]
RewriteRule \.jpg$ - [E=jpg:1]
The PT flag will not work (it does not need to) in .htaccess files.
Also why when the variable is created, locally is it called REDIRECT_jpg and on my host it's called REDIRECT_REDIRECT_jpg ?
The REDIRECT_ prefix is added each time mod_rewrite is processed, normally a .htaccess file mod_rewrite will be processed once: original request --> mod_rewrite rewrites --> new internal request --> mod_rewrite is checked but does not match --> go to file.
The request to /index.php?request.jpg matches the rule as well, so you get two or more matches: original request (/request.jpg) --> mod_rewrite rewrites --> new internal request (/index.php?
request.jpg) --> mod_rewrite rewrites --> new internal request ... (it gets to it's limit) ... go to file.