• Hello everyone,
    I’m having an issue with a multisite. this multisite has 3 sites that were added years ago. I had no problems until the other day when I added the 4th site. So I added the site without problem and the front end seems to have no issues.

    The problem is when I try to access this 4th site’s admin panel. occasionally it will redirect me to the 1st site’s equivalent page. This doesn’t happen every time though. I could sit on the 4th site’s general settings and keep hitting refresh and it seems pretty close to a 50% change I’ll get the settings for the 4th and 50% chance of getting the 1st sites admin. so

    /site4/wp-admin/options-writing.php
    gets changed to
    /wp-admin/options-writing.php

    In debugging I’ve deactivated all plugins, activated the default twentyseventeen theme. I’m also running WP 4.9.2. and I’ve commented out all htaccess lines except for the default code WP gives you to run the multisite. I’ve tried renaming the site and url with no change. I’ve installed the site locally and on a staging server, and these have worked fine. This only seems to effect the live site (on rackspace).

    This originally lead me to believe that it might be a hosting problem (I rebooted servers, asked rackspace to have a look to make sure everything was running properly, no luck)…but I’m now actually leaning towards maybe it’s WP.

    So long story short I discovered that the $_SERVER[‘REQUEST_URI’] value would sometimes be incorrect when trying to view this particular site’s admin. So I went to wp-admin/index.php and added this to the first line of the file:

    echo '<pre>'; print_r($_SERVER['REQUEST_URI']); exit;

    this would output 50% “/wp-admin/options-writing.php” and 50% “/site4/wp-admin/options-writing.php”, as expected. but if I actually create the directories/index to resolve the path /site4/wp-admin/index.php and add that snippet above it always prints the correct URI every time.

    I know wordpress changes the value of $_SERVER[‘REQUEST_URI’] (just search $_SERVER['REQUEST_URI'] = and you’ll see many results). I thought /wp-admin/index.php was the first thing to load but by the time that page gets called the $_SERVER[‘REQUEST_URI’] is already wrong. So I’m just wondering if maybe something is changing the $_SERVER[‘REQUEST_URI’] value before the /wp-admin/index.php file is run. Any help would be appreciated, I’ve spent way too long on this and I’m out of ideas. Thanks!

    • This topic was modified 8 years, 4 months ago by pm1932.

The topic ‘Incorrect $_SERVER[‘REQUEST_URI’] – Does anything load before wp-admin/index.php’ is closed to new replies.