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

XF 1.5 Forcing HTTPS with .htaccess does not work with XenForo

Discussion in 'Troubleshooting and Problems' started by JackieChun, Sep 20, 2015.

  1. JackieChun

    JackieChun Active Member

    After recently installing an SSL certificate, I enabled the following rule in .htaccess:

    RewriteCond %{HTTPS} !=on
    RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    Strangely, it works for everything except XenForo. So if you type in http://example.com, it properly redirects to https://example.com. Same with http://example.com/anyrandomdirectory/, it goes to https://. But if you type http://example.com/xenforodirectory/, it does not redirect to https://. This has left me quite stumped. I have no idea what could be causing this and how to troubleshoot it.
  2. Mike

    Mike XenForo Developer Staff Member

    You'll need to add this to your xenforodirectory .htaccess as well (just after the RewriteEngine On line).
  3. JackieChun

    JackieChun Active Member

    How is it that rules in the root .htaccess file work on all subdirectories but not /xenforodirectory?
  4. Mike

    Mike XenForo Developer Staff Member

    XenForo uses its own rewrite rules that match the URL and stop processing. You'd see this with various other applications as well.
  5. James

    James Well-Known Member

    Generally speaking a server will look for the nearest matching htaccess. So because XF's htaccess is nearer than the parent/root it will use that one.
    JackieChun likes this.

Share This Page