How to redirect url`s like this
to
Here is my rewrite rule
RewriteRule ^(.*)$ $1.php
It works with http://example/foo/bar but if the url is ending with slash a error rise (Internal Server Error) What to to do so both url types to work properly ?
How to redirect url`s like this
to
Here is my rewrite rule
RewriteRule ^(.*)$ $1.php
It works with http://example/foo/bar but if the url is ending with slash a error rise (Internal Server Error) What to to do so both url types to work properly ?
It's because the / got matched in the group .*, so you call http://example/foo/bar/.php
To make both works use :
RewriteCond %{REQUEST_URI} !\.php
RewriteRule ^(.*)/?$ $1.php
EDIT: forget when we ask a file in the first place