Return to Snippet

Revision: 65897
at February 5, 2014 20:05 by apphp-snippets


Initial Code
# Sample 1: 
RewriteRule ^about$ about.php [L]
 
# Sample 2: 
RewriteCond /%{REQUEST_FILENAME}.php -f
RewriteRule ^([a-zA-Z0-9_-\s]+)/$ /$1.php

Initial URL
http://www.apphp.com/index.php?snippet=htaccess-remove-file-extention-from-url

Initial Description
This example shows you how to remove file extension from URLs using .htaccess file directives. Remember, that "mod_rewrite" works only on Apache server. Before trying please be sure that you are working on Apache server and the "mod_rewrite" module/extension is enabled.

Initial Title
Remove File Extention from URLs in .htaccess

Initial Tags
file, htaccess

Initial Language
PHP