Force HTTPS

Discuss the phpMyAdmin Package Here.
Forum rules
We've moved! Head over to Synology Community (community.synology.com) to meet up with our team and other Synology enthusiasts!
cravaus
Novice
Novice
Posts: 58
Joined: Wed Jul 02, 2014 6:12 pm

Force HTTPS

Unread post by cravaus » Sun Jan 08, 2017 3:01 am

In the past it was easy to force HTTPS for phpMyAdmin in the config file. That stopped working when phpMyAdmin updated a while ago, but then I was able to use the Apache config file and that worked. Then I used the Nginx config and that worked. Now anymore since updating to Webstation 2.0.0-0100, phpMyAdmin is not consistently responding to redirects. So I have tried adding an .htaccces file with a redirect and that does not work. I have tried adding a redirect specific for the folder in the apache22 config file. That did not work. I have a redirect to https for the site in the apache config. It works for my other folders but not phpMyAdmin. I tried adjusting the port settings in the config files in the package center to port 443 and HTTPS then re-starting the program. That did not work. So, now my own fund of knowledge is exhausted. How can I force HTTPS?

What I have used:

Code: Select all

<VirtualHost _default_:80 _default_:443>
    DocumentRoot "/var/services/web"
	
	RewriteEngine On
	RewriteCond %{REQUEST_URI} !^http://www.example.com/phpMyAdmin
	RewriteRule ^(.*)$ https://www.example.com/phpMyAdmin/$1 [R,L]
	
	RewriteCond %{SERVER_PORT} !443
	RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/$1 [R=301,L]
	
	RewriteCond %{HTTP_HOST} !^www\.
	RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
	
</VirtualHost>
What I notice is if I enter the address as "http://example.com/phpMyAdmin" it will redirect to "https://www.example.com/phpMyAdmin" but if I enter "http://www.example.com/phpMyAdmin" no redirect happens. If I try "http://www.example.com" or another folder such as, "http://www.example.com/test" it will redirect to https. It only will not redirect when pointed to "http://www.example.com/phpMyAdmin".

cravaus
Novice
Novice
Posts: 58
Joined: Wed Jul 02, 2014 6:12 pm

Re: Force HTTPS

Unread post by cravaus » Tue Jan 10, 2017 10:00 pm

Ok, the answer, even though Apache is selected for backend, is to make the modifications to Nginx here:
https://forum.synology.com/enu/viewtopic.php?t=115182

With the Nginx redirect all is going well.

Locked

Return to “phpMyAdmin”