I'm helping a client migrate an old site which used .html extension at the end of the web address to a properly named URL structure. I want to do a redirect for all URLs that end in .html to the homepage.
I tried this but it didn't work:
RewriteRule ^(.*)\.html$ $1http://domain.org [NC]
Something like this should fit you needs:
RewriteEngine On
RewriteBase /
RewriteRule (.*)\.html$ / [QSA,R=301,NC,L]
You can use sometihing like this:
RewriteEngine On
RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ([^/]+)\.html$ index.php?page=$1 [L,NC]
or for permanent redirect
RewriteEngine On
RewriteBase /
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (.*)\.html$ / [R=301,NC,L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With