Commit d19f1358 authored by Paul Cammish's avatar Paul Cammish
Browse files

Force rewrites to HTTPS on all sites.

parent ad86d968
......@@ -3,11 +3,22 @@
php_admin_value open_basedir /usr/share/phpmyadmin:/usr/share/php:/etc/phpmyadmin
</Directory>
<IfModule rewrite_module>
# Force phpMyAdmin to use HTTPS.
RewriteCond "%{HTTPS}" "off"
RewriteCond "%{HTTP_HOST}" =""
RewriteRule "^/?(phpmyadmin.*)$" "https://<%= hostname %>/$1" [R=301,L]
RewriteCond "%{HTTPS}" "off"
RewriteRule "^/?(phpmyadmin.*)$" "https://%{HTTP_HOST}/$1" [R=301,L]
</IfModule>
<LocationMatch "^/phpmyadmin/">
# Enforce HTTPS for phpMyAdmin URLs
<IfModule rewrite_module>
# Enable rewrites
RewriteEngine On
# If HTTPS is not being used...
RewriteCond %{HTTPS} off
# ... and there is no HTTP_HOST being sent ...
RewriteCond "%{HTTP_HOST}" =""
# ... send the traffic to HTTPS on the SERVER_NAME
RewriteRule "(.*)$" https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
# If HTTPS is not being used...
RewriteCond %{HTTPS} off
# ... send the traffic to HTTPS on the HTTP_HOST
RewriteRule "(.*)$" https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
</LocationMatch>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment