MyBB Community Forums

Full Version: Strange login time behavior
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(2021-05-21, 01:18 PM)noyle Wrote: [ -> ]
(2021-05-21, 01:02 PM)Mridul Koul Wrote: [ -> ]It seems that your board URL is set to be prefixed with www., and so is your board Cookie Domain setting. Either switching to use the apex (root) domain for those settings or accessing your forum via www.kash.... would be fine.

AH YESSS! you are right about it.

But I didn't understand this part correctly  "Either switching to use the apex (root) domain for those settings". Like what exactly what I have to do to make it work for both with & without "www"?

Hmm, there might be another solution. Removing the www. prefix from the Cookie Domain setting would help. Doing so should allow successful user login/logout when visiting your forum with or without "www" or with any other sub domains.
[/quote]

I tried removing "www" from cooking domain setting but still no change

[Image: bgFgL9U.jpg]
htaccess redirects can be tricky, and apparently could also be hosting provider specific.
I noticed you are hosted on godaddy, as am I.

This redirection will rewrite the 4 possible combinations to the same url.
http or https, and www or non-www all go to https://example.com
Therefore you only have one set of cookies for authorization.

I added a CNAME entry in DNS for www to @ when the www. lookup could not be found.
Line 3 is required to work on godaddy servers. This is working for me on a VPS. Without line 3, I got redirect errors.
There are many references to a more efficient practice by redirecting in the server configuration file, but some will not have access to that.

RewriteEngine On 
RewriteCond %{HTTP_HOST} !^example\.com$ [OR]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]

This source link may be helpful for others.
https://stackoverflow.com/questions/4083...s-to-https

This htaccess evaluation tool is quite valuable.
https://htaccess.madewithlove.be

I am not an expert, just an ordinary MyBB user, so I can't say this will satisfy all security concerns or other gotchas. Perhaps others with more experience can comment.
YMMV.
(2021-05-22, 01:18 PM)HLFadmin Wrote: [ -> ]htaccess redirects can be tricky, and apparently could also be hosting provider specific.
I noticed you are hosted on godaddy, as am I.

This redirection will rewrite the 4 possible combinations to the same url.
http or https, and www or non-www all go to https://example.com
Therefore you only have one set of cookies for authorization.

I added a CNAME entry in DNS for www to @ when the www. lookup could not be found.
Line 3 is required to work on godaddy servers. This is working for me on a VPS. Without line 3, I got redirect errors.
There are many references to a more efficient practice by redirecting in the server configuration file, but some will not have access to that.

RewriteEngine On 
RewriteCond %{HTTP_HOST} !^example\.com$ [OR]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]

This source link may be helpful for others.
https://stackoverflow.com/questions/4083...s-to-https

This htaccess evaluation tool is quite valuable.
https://htaccess.madewithlove.be

I am not an expert, just an ordinary MyBB user, so I can't say this will satisfy all security concerns or other gotchas. Perhaps others with more experience can comment.
YMMV.
 Thank you so much. The issue has been resolved.

Domain doesn't work without www



RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
[url=https://stackoverflow.com/questions/10135456/domain-doesnt-work-without-www][/url]
Pages: 1 2