My standard URL is of the form http://www.example.com. The hosting package I'm using includes a shared SSL certificate. To use the shared SSL certificate it is necessary to use the URL https://hosting_domain/www.example.com. I have been trying to use mod_rewrite to rewrite all https requests to use the URL that will make use of the shared SSL certificate, but with no success. I only want to rewrite https requests, not http requests.
mod_rewrite is enabled on my shared server, and I have my own .htaccess file, which is where I have been attempting to create the necessary rewrite rules.
My only knowledge of mod rewrite is what I have read over the last few days. It have seen lots of examples on the web, but these are mainly to redirect all http requests to https. What I want to do is leave http requests as is, and only redirect https requests to the url that is prfixed hosting_domain as above.
A common example I see is the following, and I have attempted to do something based on this, but with no success.
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
I have also seen examples that test the port number, and then have rules based on that.
I'm sure it is an easy thing to do for an expert, but but I'm out of my comfort zone here, so any assistance gratefully received.