Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove .html from url

I want to remove .html from all url's of site, I am working on x-cart and want to make it possible using .htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
</IfModule>

I used this code but it doesn't work

like image 958
Karan Adhikari Avatar asked Sep 01 '26 03:09

Karan Adhikari


1 Answers

use like:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)/?$ $1.html [NC,L]
like image 84
Ishan Shah Avatar answered Sep 03 '26 17:09

Ishan Shah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!