Created
February 3, 2014 09:42
-
-
Save apphp/8781048 to your computer and use it in GitHub Desktop.
Remove File Extention from URLs in .htaccess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 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. | |
| Source: http://www.apphp.com/index.php?snippet=htaccess-remove-file-extention-from-url | |
| */ | |
| # Sample 1: | |
| RewriteRule ^about$ about.php [L] | |
| # Sample 2: | |
| RewriteCond /%{REQUEST_FILENAME}.php -f | |
| RewriteRule ^([a-zA-Z0-9_-\s]+)/$ /$1.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment