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

XF 1.5 How does Xenforo community force non-www

Discussion in 'XenForo Questions and Support' started by AliS, Jul 3, 2016.

  1. AliS

    AliS New Member

    Hello All,

    I have recently purchased an SSL and installed it on my server. The conversion from http to https is done using the CloudFlare service, which is working perfectly fine. I did not have to worry about the redirection from http to https.

    I have tried many .htaccess files posted in this community to force www but none of them worked appropriately. However, I have noticed that xenforo.com forces non-www all the time very well.

    I would appreciate it if you can share the same .htaccess file so I can modify it to force www.

    Thank you.
  2. gwordz

    gwordz Member

    Place this in your .htaccess
    #Force www:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
    RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301,NC]
    Of course, replacing www. yourdomain .com with your actual URL.
  3. AliS

    AliS New Member

    I have already tried this but did not work. I think it works only if you entered http://domain.com/blabla, not httpS://domain.com/blabla.

    I solved the problem by using CloudFlare Page Rules service.
    Now it always will redirect to www.

    Last edited: Jul 3, 2016
    gwordz likes this.
  4. gwordz

    gwordz Member

    Glad to hear you got it sorted. I was going to suggest the following for you HTTPS redirect in place of what you might already be using. But if you got it working...if it ain't broke..

    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]
    AliS likes this.

Share This Page