Quantcast
Channel: CodeSection,代码区,网络安全 - CodeSec
Viewing all articles
Browse latest Browse all 12749

I need to force ssl on the main domain but not on the subdomain

$
0
0

The main site at www.mydomain.com is set up as a secure site using an SSL certificate.

I need to create a subdomain that is not secured ( http://open.mydomain.com ).

I'm hosting with InMotionHosting.com. I've created the subdomain in cPanel and pointed it to the folder at public_html/open (the main site is at public_html/mainsite) but when I try to visit the subdomain URL I get an SSL error in Chrome, and in IE I get redirected to https://www.mydomain.com/open .

How do I fix this?

Here is my .htaccess file:

RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Change your rules to this:

RewriteEngine on RewriteBase / RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC] RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Viewing all articles
Browse latest Browse all 12749

Trending Articles