• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Please beaware of a breaking change in the REST API on the next Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

SSLRequireSSL in .htaccess causes Apache 2 Test Page to be shown

Simon1234

New Pleskian
Hi, I've encountered the following problem, and after searching for and attempting a couple of different solutions, I've gotten no closer to getting it solved.

I've got a password-protected site on a subdomain that should only be accessible over https. To do this I have the following in .htaccess, as suggested here:

Code:
SSLOptions +StrictRequire
SSLRequireSSL
SSLRequire %{HTTP_HOST} eq "subdomain.domain.tld"
ErrorDocument 403 https://subdomain.domain.tld

AuthType Basic
AuthName "Authentication Promt"
AuthUserFile /var/www/vhosts/subdomain.domain.tld/public_html/.htpasswd
Require valid-user

However, whenever SSLRequireSSL is on, http://subdomain.domain.tld shows the Apache 2 standard test page instead of redirecting to https. http://subdomain.domain.tld/index.html redirects to https://subdomain.domain.tld just fine however, and any connection directly over https works fine as well.

This seems related, but after checking the DirectoryIndex directives, I haven't found anything missing there.

The problem is somewhat similar to the one in this thread, but I've confirmed that mod_spdy isn't running on the server.

Anyone have suggestions for a solution to this?
 
Hi Simon1234,

first I strongly recommend to use the Plesk integrated "Password Protected Directories" ( Start > subscription > example.com > Password Protected Directories ) , because it's easy to use and you don't have to care about misconfigurations. As well, it uses a slightly different path for the password - files, which is much more secure.

I would use the following code, placed in the additional apache directives and suggested as well at: https://wiki.apache.org/httpd/RedirectSSL
Code:
 Start > Subscriptions > domain.tld > Websites & Domains > subdomain.domain.tld > Webserver-Settings

in HTTP directives:

Redirect permanent / https://subdomain.domain.tld/

Be aware that IF you use nginx as well, you have to set an additional entry for your protection as well, which is slightly different and can't be set over the Plesk Control Panel ( not yet implemented ).
 
Back
Top