WordPress IIS Logins Continued

Well, a final solution to the IIS logins problem is still being worked out. So far the best idea seems to create a function for redirects instead of using the header() function outright. I have already replaced each instance of mine with this:

if (!function_exists(‘redirectto’)):
// Take into account IIS issues in cookies and redirection
function redirectto($wheretogo)
{
if (strstr(php_uname(), ‘Windows’))
header(“Refresh: 0;url=$wheretogo”);
else
header(“Location: $wheretogo”);

}
endif;

Then instead of using something like:
header(“Location:”.$redirectVar);

Just replace it with:
redirecto($redirectVar);

The one problem with this method is that using the function php_uname() and looking for ‘Windows’ might not be a good solution since the Apache server also runs on Windows. Although this is true, I can’t see a problem with the Refresh header being used even if it isn’t an IIS server.

For the time being, the above fix is working like a charm. If you need to do something like this yourself simply put the above function in your /wp-includes/functions.php file. Then replace each instance of anything like header(“Location: myfile.php”) with redirectto(‘myfile.php’).

For a complete list of locations this needs to be done head over to Toby Simmons site where he has a complete rundown on what pages and lines need to be altered.

One Response to “WordPress IIS Logins Continued”

  1. Kirin Lin Says:

    My sugesstion is using the “$is_apache” variable in var.php.

Leave a Reply