Forum Moderators: phranque
**************
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^([^/]+)/$ /index.php?section=$1 [L]
**************
of course, if i call:
www.mysite.com/test/
resolves:
www.mysite.com/index.php?section=test
but when i call
www.mysite.com/test
resolves:
404 Not Found
....
I tried modifying the RewriteRule to:
RewriteRule ^([^/]+)/?$ /index.php?section=$1 [L]
(i inserted the '?' after the last '/') but that throws a 500 Internal Server Error.
Please help.
However, I suspect you've put your server into a rewrite loop, because your code contains nothing to stop index.php from being rewritten again to index.php... and again and again, until the server reaches its maximum internal rewrite limit. It's fixed easily enough:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^index\.php$
RewriteRule ^([^/]+)/?$ /index.php?section=$1 [L]