Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: superwormy on May 20, 2009, 08:42:32 PM

Title: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: superwormy on May 20, 2009, 08:42:32 PM
Sometimes if I visit this URL: aoba-metro.org/forum

It forwards me to:
http://www.aoba-metro.org/forum/index.php?PHPSESSID=4d95f4545a37875af7812a46298d9fb1;www

Which then produces a 404 error. However, when I then visit the same URL again... it suddenly works. I believe it's some sort of cookie issue.

Is there a way to fix this / does anyone know why that happens?
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: Kill Em All on May 20, 2009, 08:59:47 PM
You might want to try going to Admin>Server Settings>Feature config> and enable local storage of cookies. or if it is enabled try disabling it. Tell us how that works for you.
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: superwormy on May 21, 2009, 09:12:30 AM
OK, I tried that, but it doesn't seem to have made a difference. Could it be a stored cookie/session issue? How can I clear all stored cookies/sessions?
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: kat on May 21, 2009, 09:16:01 AM
Give us a clue, here...

What browser do you use?
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: superwormy on May 21, 2009, 10:28:23 AM
Ah, to clarify: It is not a browser-dependent thing. (I know how to clear cookies within the browser). It happens on any browser, on any machine. Firefox on Linux, Firefox on Mac, Safari on Mac.

Is there a way to clear the *server side* storage of cookies/sessions, so that I can determine if it's just some sort of corrupted session thing?
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: kat on May 21, 2009, 11:01:02 AM
You could always rename the cookie...
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: superwormy on May 21, 2009, 12:08:07 PM
Kat:
Read the rest of the thread. It's not an issue with a cookie on my computer, and I don't know where the database sessions/cookie data is stored on the server. So, how am I supposed to rename it?

The whole issue is that it redirects my incorrectly when I visit the forum initially, but then works correctly thereafter. Do you have any idea why this would happen?
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: kat on May 21, 2009, 12:43:37 PM
Admin>server settings>Cookie Name

Try making it "SMFCookie10", or something.
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: superwormy on May 21, 2009, 01:52:27 PM
Hrm, nope, that doesn't seem to make a difference.

Would SMF be doing the redirecting from aoba-metro.org to www.aoba-metro.org, or maybe that's an Apache thing...?
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: superwormy on May 22, 2009, 07:25:38 PM
I found the answer! Or at least part of it, and a fix!

In Sources/Load.php, line 1229-ish in SMF 1.1.7 looks like this:

      // Hmm... check #2 - is it just different by a www?  Send them to the correct place!!
      if (empty($do_fix) && strtr($detected_url, array('://' => '://www.')) == $boardurl && (empty($_GET) || count($_GET) == 1))
      {
         // Okay, this seems weird, but we don't want an endless loop - this will make $_GET not empty ;).
         if (empty($_GET))
            redirectexit('www');
         else
         {
            list ($k, $v) = each($_GET);

            if ($k != 'www')
               redirectexit('www;' . $k . '=' . $v);
         }
      }

That chunk of code causes the forum to redirect to an incorrect URL if you visit it from aoba-metro.org/forum because the forum is configured as www.aoba-metro.org/forum. This is a *bug* in SMF as far as I'm concerned. I want my forum accessible from either www.aoba-metro.org/forum *OR* aoba-metro.org/forum, and I don't want it to redirect my users if they visit it from one URL or the other.

I commented out those lines and it fixed the problem.
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: JBlaze on May 22, 2009, 07:39:31 PM
There must be something wrong with the redirect as I get http://www.mysite.com/index.php?PHPSESSID=26b0e401608d7f52617e1c3397b2ca83;wwwRedirect

Note the added Redirect after www.
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: superwormy on May 22, 2009, 07:59:55 PM
Weird. Same version of SMF? 1.1.7? Maybe it's been fixed in other versions.
Title: Re: Sometimes I get a 404 error from SMF when visiting the forum...
Post by: JimM on May 24, 2009, 04:19:05 PM
If this is solved please mark it solved by clicking the Mark Topic Solved link at the bottom left of the page.