XF 1.5 Rewrite to SSL & without-"www" works well on site but not with XF


SSL & without-"www" rewrites work well when loading html pages from root and subdiretories. However, when loading the XF board, none of the rewrites work, i.e., no switching to https and no "www" removal occurs.

Though, I can make it all work if I comment everything from (including) "<IfModule mod_rewrite.c>" to "</IfModule>".
in the XF's .htaccess -- but I suppose that is a bad way to solve it.
  • Apache, shared

  • XF files are in a subdirectory like root/xenforo

  • The SSL & without-"www" rewrites are in root .htaccess.

  • I've tried redirects recommended by the host and also by Brogan's faq with same result.

  • The config.php https switch is set to 'on', placed at the end.

  • Tried comment/uncomment "RewriteBase /xenforo" in XF's .htaccess

Code example (didn't work) used in root .htaccess:
# Brogans force https
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#Rewrite to domain without www
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^(.*) http://%1/$1 [QSA,L,R=301]

Am I doing something apparently stupid here? If not, what would you try next?



XenForo developer
Staff member
You need to put your custom rules above XF's existing rewrite rules. The last rule in XF is a catch all, so it stops the rewrite execution.
Ok, I tried but couldn't get my custom rules put in XF's .htaccess »play» with my custom rules in the root .htaccess (rules for the entire site) . When trying, I'm usually beeing thrown back to root index.html.

Anyway, I suppose the XF default .htaccess rewrites is to redirect to something better than the ugly message
"Not Found The requested URL... was not found on this server" if a file don't exist.

I'm ok with such message so I might as well comment the XF default .htaccess rewrites -- to make my root .htaccess rewrites work on the entire site, including XF (That does for sure work).

Or, do I lose anything else, perhaps more severe, by commenting that out?

Thanks for the input.