I have example.com page. I want a homepage without index.html (example.com/index.html -> example.com)
RewriteEngine On
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^(.*)/index\.html$ /$1/ [R=301,L]
It works but what rule to create for folder /de/ (language)?
Code above in folder /de/ redirects me to example.com (example.com/de/index.html or example.com/de/index -> example.com). Correct link: example.com/de/
How to make a rule for /de/ folder? How to modify rule?
Expected effect
example.com/index.html example.com/index -> example.com
example.com/de/index.html example.com/de/index -> example.com/de/
.htaccess - example.com
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]
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^(.*)/index\.html$ /$1/ [R=301,L]
ErrorDocument 404 /
Options +Multiviews
.htaccess - example.com/de/
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]
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^(.*)/index\.html$ /$1/ [R=301,L]
ErrorDocument 404 /de/
Options +Multiviews
curl --head
on the command line?.htaccess
file in the document root directory? You have no other.htaccess
file? Do you have any other directives in your.htaccess
file?index.html
" - To confirm, you are already linking to the canonical URLs, withoutindex.html
?