Let’s have a look at this output:
ls -l /etc/apache2/sites-enabled/
lrwxrwxrwx 1 root root 52 Aug 22 05:32 mydomain.com-le-ssl.conf -> /etc/apache2/s ites-available/mydomain.com-le-ssl.conf
lrwxrwxrwx 1 root root 35 Aug 22 05:25 mydomain.com.conf -> ../sites-available/ mydomain.com.conf
OK it is most likely the second file.
Let’s have a look at that file:
cat /etc/apache2/sites-enabled/mydomain.com.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/mydomain.com/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =mydomain.com [OR]
RewriteCond %{SERVER_NAME} =www.mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
If you remove or remark these four lines you will NOT have any redirection.
But let's try to do that one better...
Let's replace those four lines with these lines:
<LocationMatch "^/(?!api\/auth)">
#exclude "api/auth" and send all other requests to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1
</LocationMatch>
I ll start stop redirecting everything, because I can’t access the control panel, it gives me a 404 error … I must leave the site operational during the day and correct it at night.
Can I comment on those four lines and then uncomment them to activate it?
In the same way I will take into account the other solution, I am sure I will need it.
Yes, just restart or reload apache after any change.
I am very grateful, then I will review what I must configure to be able to access the control panel with https, I still have to learn a lot.
Cheers from Miami
and restart apache
Cool, thank you again!
I do it and restar with: sudo systemctl reload apache2 but no found
Its okey… Thank you!
I was trying that:
But is no stopping
Did you manage to reload Apache already?
please answer all of the questions you have deleted.
"Trying" - your domain name is required.
Try:
sudo service apache2 restart
OR reboot the droplet (shutdown + restart):
sudo shutdown -r now
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.