Forum Moderators: phranque
Can someone tell me whats wrong with this code? It works locally but gives a 500 error on my server (with nothing in the error log)
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI}!index\.php$
RewriteRule ^([^/]+)/stylesheets/([^/]+)/([^/^?]+)$ /index.php?site=$1&template=$2&stylesheet=$3
RewriteRule ^([^/]+)/(.*)$ /index.php?site=$1 [L]
Thanks
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^foo\.bar$ /index.php [L]
Jim
1) i didnt know the RewriteCond only applies to the next rule - how do you make it apply to all following rules?
2) I tried with [L] - no difference.
3) I checked and there is no .htaccess in the subfolder sending it into an infinite loop.
What's confusing is each of these RewriteRules work on their own and both together on my localhost but not both togehter on the remote server...
You don't. The easiest solution is to repeat the RewriteCond for each rule.
> 2) I tried with [L] - no difference.
Use [L] anyway, unless you *know* you can't use it. Otherwise the output of each rewrite is processed by all the following rewrites, which is usually a hug waste of time.
> 3) I checked and there is no .htaccess in the subfolder sending it into an infinite loop.
Yeah, probably not a problem, as long as you have a RewriteCond on each rule.
Jim