I need to redirect my website from http to https in order to use the SSL certificate, but I also want to remove .html at the end of URL. I can't seem to get it to work.
This is my code:
# Redirect HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Remove .html from URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]
The following code disables the SSL and doesn't reroute to HTTPS.
Aucun commentaire:
Enregistrer un commentaire