Print Thread
Hop To
Joined: Jun 2006
Posts: 16,301
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,301
Likes: 116
One thing that pops up every so often is errors with cookies due to users accessing your forum without accessing it through the "www" subdomain (yoursite.tld versus www.yoursite.tld), all works until they go to do something that requires you to be logged in.

When they send a request to the www subdomain they're told that they need to log in again, and they are *technically* logged in, the cookie doesn't transverse to the www subdomain as they haven't logged into it.

This is easy to fix, and takes only a few minutes. Basically you nerf the ability for them to even access your site without the "www" subdomain, if they do, it'll simply forward their request to the www subdomain, which will include logging in, so there shoudln't be any issues with logging in or preforming any tasks that rely on cookies being set for a specific domain.

Add the following to your .htaccess file:
Code
RewriteCond %{HTTP_HOST} ^yoursite.tld$
RewriteRule ^(.*) http://www.yoursite.tld/$1 [QSA,L,R=301]

You would add the same two lines for each domain on your site, mine is:
Code
# Redirect non-www URLs to WWW
RewriteCond %{HTTP_HOST} ^undergroundnews.com$
RewriteRule ^(.*) http://www.undergroundnews.com/$1 [QSA,L,R=301]
RewriteCond %{HTTP_HOST} ^undergroundnews.net$
RewriteRule ^(.*) http://www.undergroundnews.net/$1 [QSA,L,R=301]
RewriteCond %{HTTP_HOST} ^undergroundnews.org$
RewriteRule ^(.*) http://www.undergroundnews.org/$1 [QSA,L,R=301]
RewriteCond %{HTTP_HOST} ^undergroundnews.info$
RewriteRule ^(.*) http://www.undergroundnews.info/$1 [QSA,L,R=301]
RewriteCond %{HTTP_HOST} ^ugnsecurity.com$
RewriteRule ^(.*) http://www.ugnsecurity.com/$1 [QSA,L,R=301]

If you don't have a .htaccess file, you can just create one (named .htaccess) and upload it to your web root directory. It's a good idea to ensure you don't already have one before just adding a new one to your site. Also keep in mind that in unix/linux items prefixed with a "." are signified as hidden, so be sure your ftp client is listing hidden files when you go to edit your .htaccess file.

It'd also be good to note that this only works in apache (to the best of my knowledge).


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Jun 2006
Posts: 3,837
I
Ian Offline
Carpal Tunnel
Carpal Tunnel
I Offline
Joined: Jun 2006
Posts: 3,837
Or this can be put into the vhost.conf file (or similar) - personally I prefer this outside of the .htaccess file.

Joined: Jun 2006
Posts: 16,301
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,301
Likes: 116
'eh sure if they can ACCESS their vhosts.conf or httpd.conf; was mainly drawn up as is for users who aren't on a dedicated/vps box.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Jun 2006
Posts: 3,837
I
Ian Offline
Carpal Tunnel
Carpal Tunnel
I Offline
Joined: Jun 2006
Posts: 3,837
indeed - was just mentioning an alternative, which in my view is better if that option exists.

Joined: Jun 2006
Posts: 16,301
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,301
Likes: 116
True, I have a VPS (well, work with several) and like to do all site specific configurations through .htaccess versus making changes in the httpd.conf; no real reason other than I don't have to restart apache after a bunch of changes...


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Version 7.7.5 Images suddenly not displaying
by Stovebolt - 05/04/2024 11:19 AM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
Who's Online Now
0 members (), 1,083 guests, and 203 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)