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.
-
Possible duplicate of stackoverflow.com/questions/4026021/…nmc– nmc2011-09-23 16:15:11 +00:00Commented Sep 23, 2011 at 16:15
Add a comment
|
1 Answer
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?