/ Published in: PHP

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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# Sample 1: RewriteRule ^about$ about.php [L] # Sample 2: RewriteCond /%{REQUEST_FILENAME}.php -f RewriteRule ^([a-zA-Z0-9_-\s]+)/$ /$1.php
URL: http://www.apphp.com/index.php?snippet=htaccess-remove-file-extention-from-url
Comments
