Mobile app version of vmapp.org
Login or Join
Angie530

: Only use HTTPS for main site and HTTP for subdomains I have a few static files on a i. subdomain but I don't have an SSL certificate and for its use it doesn't need one, however when I

@Angie530

Posted in: #Htaccess #Https #SecurityCertificate #Subdomain

I have a few static files on a i. subdomain but I don't have an SSL certificate and for its use it doesn't need one, however when I try to access it - it redirects for https which throws up an error and doesn't work.

I am currently using this in my .htaccess

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI}

What is needed to make it ignore the i. subdomain?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Angie530

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

Add another condition to exclude the subdomain:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^i.
RewriteRule ^ %{HTTP_HOST}%{REQUEST_URI} [R=301,L]


Presumably the www canonicalisation is already handled elsewhere?

This should probably be a 301 (permanent) redirect, rather than a 302 (temporary).

There is no need to capture the RewriteRule pattern (ie. (.*)) unless you are using it in the substitution.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme