0

So I'm trying to get my server configured in a specific way so that anyone who visits http://www.subdomain.domain.com or https://www.subdomain.domain.com gets redirected to https:// without the www.

What Htaccess would I need to achieve this?

0
RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

RewriteCond %{HTTP_HOST} ^www\.subdomain\.domain\.com$ [NC]
RewriteRule ^(.*)$ https://subdomain.domain.com/$1 [L,R=301]
  • If I visit subdomain.com that isn't redirecting to subdomain.com – Tenatious Aug 29 '13 at 17:18
  • Then edit your question and clearly define what do you want. – GioMac Aug 29 '13 at 17:19
  • Pretty sure my question included the https:// part.... The example is clients.evaske.com. I need that to link to clients.evaske.com as you can see if you click the link it throws up an SSL error. – Tenatious Aug 29 '13 at 17:20
  • 1
    You're going to get the SSL error with that cert unless you get a cert that matches *.clients.evaske.com. The rewrite only takes place AFTER the cert is presented. – TheCleaner Aug 29 '13 at 17:28
  • Is there no way to make it redirect before the certificate request? – Tenatious Aug 29 '13 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.