S
S
santehmarka2021-09-30 10:01:39
htaccess
santehmarka, 2021-09-30 10:01:39

How to remove double redirect?

Is it possible to somehow remove the double redirect from index.php/index.html pages. Redirects from other pages in one step, and from these in two steps:
For example, go to https://www.example.com/index.html
First, redirect to htр://www.example.com/
And then to https: //example.com/

Now these are the rules in htaccess:

RewriteEngine On

RewriteBase /

RewriteCond %{THE_REQUEST} // 
RewriteRule .* /$0 [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ / [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ / [R=301,L]

RewriteRule (.+)\.html?$ https://example.com/$1/ [R=301,L]

RewriteCond %{HTTP_HOST} ^www.example\.com [NC]
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]

RewriteCond %{ENV:HTTPS} !on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sand, 2021-09-30
@santehmarka

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ https://example.com/ [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question