1//put this piece of code in the root file .htaccess
2RewriteEngine on
3#remove extension html
4RewriteCond %{REQUEST_FILENAME} !-d
5RewriteCond %{REQUEST_FILENAME}\.html -f
6RewriteRule ^(.*)$ $1.html [NC,L]
7
8#remove extension php
9RewriteCond %{REQUEST_FILENAME} !-d
10RewriteCond %{REQUEST_FILENAME}\.php -f
11RewriteRule ^(.*)$ $1.php
1# Apache Rewrite Rules
2 <IfModule mod_rewrite.c>
3 Options +FollowSymLinks
4 RewriteEngine On
5 RewriteBase /
6
7# Add trailing slash to url
8 RewriteCond %{REQUEST_FILENAME} !-f
9 RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
10 RewriteRule ^(.*)$ $1/ [R=301,L]
11
12# Remove .php-extension from url
13 RewriteCond %{REQUEST_FILENAME} !-d
14 RewriteCond %{REQUEST_FILENAME}\.php -f
15 RewriteRule ^([^\.]+)/$ $1.php
16
17# End of Apache Rewrite Rules
18 </IfModule>
19