/ Published in: Apache

Add source to .htaccess file and server will hide .php extensions. href tags must reference the file name without the extension .php in order to work properly.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / # To externally redirect /dir/foo.php to /dir/foo/ RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R,L] # To internally redirect /dir/foo/ to /dir/foo.php RewriteCond %{DOCUMENT_ROOT}/$1.php -f RewriteRule ^(.*?)/?$ $1.php [L]
Comments
