I want to use .htaccess
mod_rewrite
to remove .php
from all my files and force a trailing slash /. However, it is only resulting in me getting server errors.
Asked
Active
Viewed 509 times
1
-
Possible duplicate of http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess – nmc Sep 23 '11 at 16:15
1 Answers
2
You want to map :
http://sampledomain.ext/index/ -> http://sampledomain.ext/index.html
Use the following .htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} ! \.php$ #Avoid real php page, do what you want with them
RewriteCond %{REQUEST_URI} /$ #Ensure a final slash
RewriteRule ^(.*)$ $1.php #Add your extension
Tx to David Wolever who write quitely the same stuff 1
If I can give my opinion, it's a little bit strange to force the / at the end for a file no?

Community
- 1
- 1

Guilhem Hoffmann
- 962
- 5
- 13