I manage a server with many accounts that need to be accessed through HTTPS. Rather than purchasing an SSL certificate for each domain, I have a wildcard SSL certificate installed at *.example.com. I need some sort of mod_rewrite directive to point sub-subdomains of secure.example.com to the correct directories on the server. For example, I want https://account1.secure.example.com/index.html to point to /home/account1/public_html/index.html.
I tried adding this to .htaccess under example.com's directory:
- Code: Select all
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.secure\.example\.com
RewriteRule ^(.*)$ /home/%1/public_html$1
However, for HTTPS requests, it causes a 500 error, and for HTTP requests, it just serves the content from example.com. Can anyone help?