1
I don’t quite understand the . htacces, but I use it to force the navigation of my site to the https, now I’m trying to implement a code to remove the .html but when I put the two together it doesn’t work.
Force https:
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
Remove . html from URL:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]
How I make the two of you work together?
But the ". html" still continues even taking the [L] of the top.
– HBretone
What do you mean it doesn’t exist? I thought it would take the ". html" out of the URL I had done something like this, must have fooled me then, sorry.
– HBretone
@Bretone
RewriteCond %{REQUEST_FILENAME} !-f
sets a condition to run the rule only when the file (-f
) is not present in the folder. You can remove this condition to check if the rule is working, but I think this will give you a 404.– Mariano