Hi,
This is the htaccess I have: Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/pages
RewriteRule ^(.+)/$ /$1 [NC]
RewriteRule ^$ /pages/index.php [NC]
RewriteRule ^([a-z]+)\?([^/]+)$ /pages/$1.php?$2 [NC]
RewriteRule ^([a-z]+)/([^/]+)$ /pages/$1.php?q=$2 [NC]
RewriteRule ^([a-z]+)$ /pages/$1.php [NC]
ErrorDocument 404 /pages/404.php
What is should do is quite simple:
- remove trailing slash from URL
- direct example.com/tomato to example.com/pages/tomato.php
- direct example.com/tomato?c=red&size=big to example.com/pages/tomato.php?c=red&size=big
- direct example.com/tomato/red to example.com/pages/tomato.php?q=r
But this is the problem: any URL of the for /pages/tomato.php matches line 7 of the .htaccess which would produce an infinite loop. That's why I added an exception for /pages but it seems to be ignored - I still get 500 Internal Server Error with this log message:
mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.
Could this have something to do with the fact that I'm running this with virual hosts? If so, what should be done to fix it?