Skip to content

Instantly share code, notes, and snippets.

@mskian
Created January 16, 2016 11:53
Show Gist options
  • Save mskian/1cf19e86520f48c18f5a to your computer and use it in GitHub Desktop.
Save mskian/1cf19e86520f48c18f5a to your computer and use it in GitHub Desktop.
Complete htaccess code for remove file extension + add a trailing slash like wordpress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php
#RewriteRule ^([a-z]+)\/?$ $1.php [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html
#RewriteRule ^([a-z]+)\/?$ $1.html [NC]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment