https redirect issue

#1
Hello,

I have some problems with redirecting http to https. If I write https:// example.com in the browser address bar it works just fine. However, if I type http:// example.com it does not redirect me to https, but it shows me the server default page.

redirect.png

My .htaccess file contains the following code:
Code:
RewriteEngine On
RewriteCond %{HTTPS}  !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
I, obviously, changed example. com to my domain name.
Rewrite is enabled in OLS:

rewrite.png

Any suggestions?
 
Last edited:

Cold-Egg

Administrator
#2
Try putting the following rules on the top of your .htaccess file, graceful restart OLS, and see if it works.
Code:
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI}/$1 [R,L]
 
#4
Try putting the following rules on the top of your .htaccess file, graceful restart OLS, and see if it works.
Code:
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI}/$1 [R,L]
This did not work either.
I noticed that the default listener is not running and I don't know why. Maybe this might have something to do with the issue.

http.png

default listener.png

I'm using Cyber Panel.
 
#8
The listener with Port 80 is not up, maybe you have a config issue or another service is using the same port, you might need to fix this part first.
Where should I look for a missconfiguration on port 80?

I'm seeing this in the logs

error80.png

After some investigation I found out that there are several apache processes that use port 80. Is this normal?
80.png
 
Last edited:
#9
I solved the issue. Apparently apache2 was started on port 80. I don't know why it was started, maybe I installed it on the vps server and then moved on to OLS with Cyber Panel. I rebooted the server but the system started by default apache2 on port 80. I just stopped apache2 and gracefully restarted OLS. Now everything works as expected.
One more question, thou: is apache needed for OLS or I can remove it completely from the vps?
 
Top