Answer the question
In order to leave comments, you need to log in
How to remove .html from url on website and redirect /uk to /uk/ (to https and without www)?
Hello. How can I set up a redirect on the site from /uk to /uk/ if the file is in the root with the name uk.html? Is it possible to set the page url if, for example, it is in a folder like home-ukrainian.html but it was displayed as /uk/?
Site on https, without www
Now htaccess is configured like this:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule ( .*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#Remove .html extension
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ %1 / [NC,L,R]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ $1.html [NC,L]
ErrorDocument 404 /404.html
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question