1. 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

Discussion in 'Troubleshooting and Problems' started by gunnar, Nov 19, 2015.

  1. gunnar

    gunnar Active Member

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

    xF is main domain
    domain.com

    WP is on subdomain
    wp.domain.com

    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]
    "
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Add these rules to the top of the .htaccess file in each directory:

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

    gunnar 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! :)
     

Share This Page