Redirecting .html to non .html pages using .htaccess code



If you have a website with URLs like and if you want to redirect that to, then you can try the below mentioned code. Copy/paste this into your .htaccess file. Make sure you replace with your own URL.

RedirectMatch 301 ^/([^/]+).html$$1

This should work fine, and if your website has ‘https’ instead of ‘http’, do change that as well. :slight_smile:

Update - If the above code is not working for your website, you can try these instead:

RedirectMatch 301 ^/([^/]+)/([^/.]+).html$ /$1/$2/
RedirectMatch 301 ^/([^/]+)/([^/]+)/([^/.]+).html$ /$1/$2/$3/

HTACCESS useful Rewrite Codes 2017