T
T
Tarakanishe2021-08-27 09:05:57
Apache HTTP Server
Tarakanishe, 2021-08-27 09:05:57

How to redirect to port 80 and 443 without err_too_many_redirects error?

There is a site at the entrance to which the URL must be appended, for example mysite.ru to mysite.ru/app01. I did it on port 80, and when I add the same virtual host on port 443, the error err_too_many_redirects appears. I can't figure out where the loop is.

<VirtualHost *:80>
        ServerAdmin     [email protected]
        ServerName     t.mysite.ru
        RewriteEngine on
        RewriteCond %{SERVER_NAME} =t.mysite.ru
        RedirectMatch permanent (.*)/$ https://t.mysite.ru/myapp01
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/acces.log combined
</VirtualHost>

<VirtualHost *:443>
        ServerAdmin     [email protected]
        ServerName     t.mysite.ru
        RewriteEngine on
        RewriteCond %{SERVER_NAME} =t.mysite.ru
        RedirectMatch permanent (.*)/$ https://t.mysite.ru/myapp01
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/acces.log combined
</VirtualHost>


Everything works fine on port 80, but if you manually go to https://t.mysite.ru , it will not add the URL to myapp01

even if you leave the 443 host as it is, this error is still there, although there are no redirects inside
<VirtualHost *:443>
        ServerAdmin     [email protected]
        ServerName     t.mysite.ru
</VirtualHost>

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