Apache Mod_Userdir with SSL

vlee

Well-Known Member
Oct 13, 2005
374
26
178
Spokane, Washington
cPanel Access Level
Root Administrator
I would like to how you this below can be done.

Say you allow users to use this http://host.example.com/~username

But there is a catch force it is use the Shared SSL Certificate that is on host.example.com

So they will see this https://host.example.com/~username in the address bar.

I just want make this feature very secure and free to use for customers.

Can anyone tell me how to force users to use the Shared SSL Certificate if they want to use this https://host.example.com/~username feature?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Hello :)

You could try using a custom Mod_Rewrite rule in the VirtualHost for the hostname of the server (or the host that you have configured as a shared SSL). EX:

Code:
<VirtualHost 1.1.1.1:80>
    ServerName host.domain.com
    DocumentRoot /usr/local/apache/htdocs
    RewriteEngine on
    ReWriteCond %{SERVER_PORT} !^443$
    RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
    ServerAdmin [email protected]
    <IfModule mod_suphp.c>
        suPHP_UserGroup nobody nobody
    </IfModule>
</VirtualHost>
The following URL documents how to make a change to a single VirtualHost:

EasyApache: Changes Contained Within a VirtualHost Directive

Note that per our documentation, if you want to enable mod_userdir so that shared SSL certificates can be used, you will need to either add users to, or exclude protection from, the virtual host for the domain to which the certificate was issued.

Thank you.