• 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

#1
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
I would appreciate it if you can share the same .htaccess file so I can modify it to force www.
Place this in your .htaccess
Code:
#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
Place this in your .htaccess
Code:
#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.
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.

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

:)
 
Last edited:
#4
I solved the problem by using CloudFlare Page Rules service.
Now it always will redirect to www.

:)
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..

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