'Internal Server Error' on first time landing on page

Started by IvaliceAlliance, May 09, 2013, 07:22:17 PM

Previous topic - Next topic

IvaliceAlliance

I'm having this same exact problem, but putting "ini_set('arg_separator.input', ';&');" in my index.php file did not fix this.

Any other way I can get the ;wwwRedirect fixed?

Arantor

The wwwRedirect is part of SMF, it is supposed to be there.

An Internal Server Error problem is a generic error, there are many many reasons for it, the symptoms you're describing are probably not the cause...
Holder of controversial views, all of which my own.


TheListener

IvaliceAlliance

I have split your post and made it into a new topic.

The other topic was a year old plus we usually prefer users not to latch onto another users posts for various reasons.

Colin

Welcome to SMF!

Is there anything in the server error log?
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

IvaliceAlliance

Okay, let me be more specific.

I have a few boards on my forum that I am using the "Redirect to a web address" feature checked to redirect to a specific page I setup using SimplePortal. I am using this to track how many times the link was clicked. It seems to work fine if a user is logged into the forum, but if they are not logged in, the address gets wonky and an "Internal Server Error" page is displayed with Error 500.

So clicking on something like this:
http://www.mysite.net/forums/index.php?board=75.0 [nofollow]

Will take you to an address such as this:
http://www.mysite.net/forums/index.php?PHPSESSID=cc254c80437c7886e02ad39c9d09b055;page=desiredpage [nofollow]

Along with this error:
QuoteInternal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I've set my redirect URL to be this:
http://www.mysite.net/forums/index.php?page=desiredpage [nofollow]
Which is a page I had made in SimplePortal.

If you replace the ; with an & in the webaddress, it works as desired but I don't know why the semicolon is appearing to begin with. I'm also not certain why PHPSESSID is appearing in the URL either.

Any help with this would be much appreciated.

Thanks.

IvaliceAlliance

Any suggestions at all?

These errors don't seem to be showing up in my error log either.

Oldiesmann

The problem is indeed the semicolon after the "PHPSESSID" string. PHP for some reason thinks that it's part of the session ID string (despite you telling it that semicolons can be used to separate arguments in the querystring), and semicolons aren't allowed in session IDs, so that's what's causing the error.

That said, I believe this change will still work for you (note that this was for a different version of SMF, but the code appears to be the same in 2.0):

Quote from: Oldiesmann on October 25, 2006, 04:27:24 PM
Sources/Subs.php

Find
$setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '(?!\?' . preg_quote(SID, '/') . ')(\?)?/', $scripturl . '?' . SID . ';', $setLocation);

Replace
$setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '(?!\?' . preg_quote(SID, '/') . ')(\?)?/', $scripturl . '?' . SID . '&', $setLocation);

That tells SMF to use an ampersand instead of a semicolon after the session ID is inserted.

IvaliceAlliance

Thanks a lot! Works just like it should now.

Anyway we can get this fix implemented into SMF  so no one else runs into this problem in the future?

Advertisement: