The Codesee The Codesee - 1 month ago 5
PHP Question

Remove html extension from url using mod rewrite

I have used mod rewrite to change this url:

http://example.com/first.php?second=third


To:

http://example.com/third.html


Using this:

RewriteRule ^([^/]*)\.html$ /first.php?second=$1 [L]


How can I remove the
.html
file extension?

Answer Source
RewriteRule ^([^\.]+)$ $1.html [NC,L]