• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 HTTPS Help to set up forced redirects


Active member
I'm trying to set HTTPS on xF and WP. I have two SSL certificates registered.

xF is main domain

WP is on subdomain

xF is in a subfolder on the WP install.

I tried adding a redirect in the root htaccess, but it must have wrong.

Can I use this in root htaccess? I have no idea what this means or does, I would replace www.domain.com with my domain. Do I put subdomain somewhere?

RewriteEngine On

# for subdomains
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.|)(.*)$ [NC]
RewriteRule ^.*$ https://%1%{REQUEST_URI} [R,L]

# for main domains
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^.*$ https://www.domain.com%{REQUEST_URI} [R,L]

Jake Bunce

XenForo moderator
Staff member
Add these rules to the top of the .htaccess file in each directory:

	RewriteEngine On

	RewriteCond %{SERVER_PORT} 80
	RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
These same rules should work in both locations.


Active member
Thanks, I used a code that seems to work, sending PM. Would greatly appreciate if you could look into my sites and see if what I have used is working! :)