Redirect http to secure https url for a specific domain name

We had a wildcard certificate *.example.com. We have other website too hosted on the same server like http://www.newexample.com.
Now we don’t have a certificate for http://www.newexample.com so, we want to redirect when someone types http://test.example.com to https://test.example.com.

So when a user types http://test.example.com they should be redirected to https://test.example.com. But http://www.newexample.com should not redirect to https://www.newexample.com instead of the fact that they both are hosted on same server and share same .htaccess file.

Here is the solution: (add this in your main root .htaccess file)
RewriteCond %{HTTPS} !on
RewriteCond %{SERVER_NAME} ^(.*.suiterx.com)
RewriteCond %{REQUEST_URI} !^(.*.wsdl) ##bypass wsdl file calls
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s