I did not manage to find a working solution to the below explained problem neither in stack exchange nor in third party websites.

I have a website with domain: example.com

Any requests to https://example.com and https://www.example.com display the website properly. Also, there is a working redirect from http to https.

My SSL certificate is a simple one which secures only the domain and the www.

Now, the URL of the administrative area for this website is http://administrator.example.com and that also works fine. It is however served under http because the SSL certificate is the simple and cheap "Comodo essential" which does not secure subdomains other than the "www" one (as stated before).

My question is: Can I rewrite the administrative URL from: http://administrator.example.com to: http://www.example.com/administrator/ (which will eventually redirect to the secure: https://www.example.com/administrator/) BUT that should just rewrite the URL since the actual requests should continue (silently) be called from: http://administrator.example.com

As an example, I would like the hypothetical address: http://administrator.example.com/pages/new.php to rewrite the URL secure and as subdomain: https://www.example.com/administrator/pages/new.php but still request all the resources from the actual (non-secure) subdomain: http://administrator.example.com/. For instance: http://administrator.example.com/index.php or various assets: http://administrator.example.com/css/style.css etc...

I don't know if something like that is even possible, yet if it is, any help would be appreciated. (I thought I'd give it a shot asking a question, before I would consider buying a wildcard certificate)

Any ideas?


In the website's root directory, I created a folder administrator/ with an empty index.php file in it. In the same folder, I created an .htaccess file that looks like that:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301]
RedirectMatch 301 ^/adminisrtator/(.*)$ 

(That redirects ok, but (as the last line implies) also changes the browser's url to the good old insecure one: http://administrator.example.com/ which of course is no good...)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.