G
G
Grizar2020-01-28 23:38:15
htaccess
Grizar, 2020-01-28 23:38:15

Redirect to https all except the main one?

Help with redirect rule.
1- You need to redirect everything except index.html
from http to https
2 - and is it possible to redirect so that index.html opens and not index.php
And I will add that all this is on WordPress, you never know.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita Shinkevich, 2020-01-29
@domres

Well, in order to open .html and not .php, it is decided in .htaccess with the line:
DirectoryIndex index.html index.php
That is, it will first look for the .html file, if it does not find it, it will look for index.php ... and so on .. .here you can specify any file in capitals in the directory when accessing it.
Regarding redirects:
RewriteCond %{HTTP_HOST} ^www.domain-bez-https.ru$ [NC]
RewriteRule ^(.*)$ https://www.domain-s-https.ru/$1 [R=301,L ]
This is a general redirect to https... but how to do this so that everything except the index file, which I don’t remember... well, in fact, the browser often does not access domain.ru/index.html, but opens donain.ru by default ... it seems like these are two different addresses considered in the eyes of the server...

V
Viktor Taran, 2020-01-29
@shambler81

RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !(.*)/index\.html
RewriteRule ^.*$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question