I'm Developing one website and want to remove the extensions from my website s7info in order to make the URLs more user and search friendly. I stumbled across tutorials on how to remove the .php extension from a PHP page. What about the .html? i want to remove those as well..!!
Asked
Active
Viewed 149 times
-3
-
2go through this link http://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess – rahul Sep 06 '16 at 05:01
-
Read this https://alexcican.com/post/how-to-remove-php-html-htm-extensions-with-htaccess/ – aavrug Sep 06 '16 at 05:02
-
Thanks for referral link ...! – Ishita Patel Sep 06 '16 at 08:46
1 Answers
1
try this,
.htacess file
<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]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.htm -f
RewriteRule ^(.*)$ $1.htm
#RewriteRule ^([a-z]+)\/?$ $1.htm [NC]
</IfModule>

Dave
- 3,073
- 7
- 20
- 33