D
D
Dima2017-07-11 11:54:37
htaccess
Dima, 2017-07-11 11:54:37

How to enable authorization via htaccess along with a redirect to https?

After moving the site to https, authorization through htaccess to the admin panel stopped working.
.htaccess content:

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

# Статические страницы
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/?$ index.php?module=PageView&page_url=$1 [L,QSA]
RewriteRule ^/?$  index.php?module=MainView&page_url= [L,QSA]

When entering /admin , it immediately gives an error 401 Unauthorized, and if you comment out the first 2 lines, everything works fine. Tried redirecting to https in many different ways, including exclusion of /admin from redirecting as per this question , but still doesn't work. Perhaps he did something wrong. Tell me, please, what could be the problem and what code is needed for htaccess.
Perhaps this is due to the fact that everywhere URLs have become like this: /index.php?module=MainView&page_url= ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question