• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

.htaccess file redirecting http://www.domain.com to https://domain.com

Flea77

Limp Gawd
Joined
Nov 9, 2004
Messages
143
So, I know virtually noting about the .htacess file other than some very basic ideas of what it is used for. Mine is huge (142 lines), I think primarily for the WordPress cache plugin I use, which makes it all that more confusing. But I digress.

My current site will redirect http://www.domain.com to https://domain.com and that seems to be a problem with my CDN as it wants everything to be on a www.domain.com.

So what I think I need is to change it from what it is doing now to redirecting to https://www.domain.com. I believe the lines in the file responsible for this are:

RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^domain.com

but I am unsure of how to modify them to achieve what I need. Those two lines appear in two different places in the .htaccess file. There is also these lines which may mean something:

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

and lastly, I may need to modify this line:

RewriteCond %{HTTP_HOST} ^domain.com

Which appears by itself (without the RewriteCond %{HTTPS} =on line above it).

Ideas? Suggestions? Pointers?
 
Code:
RewriteEngine On
# Redirect to the correct domain name
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^/?(.*)$ https://www.domain.com/$1 [NE,L,R=301]

Should do it. But realistically you should modify your Apache .conf instead of the .htaccess since that has to be parsed each hit.
 
Back
Top