: 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
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?
More posts by @Angie530
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.