Hide .php add a slash
Posted
by
Matthew
on Server Fault
See other posts from Server Fault
or by Matthew
Published on 2010-09-28T17:27:04Z
Indexed on
2010/12/22
15:56 UTC
Read the original article
Hit count: 327
This script works perfect it forces the trailing slash and hides the .php extension
BUT! it does not redirect people going directly to the .php extension.
How can I also force people going directly to the file.php to /file/
RewriteEngine On
RewriteRule ^(.*)/$ /$1.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.mysite.com/$1/ [R=301,L]
© Server Fault or respective owner