Remove File Extension from URLs in .htaccess
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.
[View All Snippets]
[View All Snippets]
Show Plain Text »
- # Sample 1:
- RewriteRule ^about$ about.php [L]
- # Sample 2:
- RewriteCond /%{REQUEST_FILENAME}.php -f
- RewriteRule ^([a-zA-Z0-9_-\s]+)/$ /$1.php