• gaiiden

    (@gaiiden)


    I’ve had this code running on my site since 2004 in order to handle multiple WP installs that all use sub directories, based off of this article:

    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', true);
    
    if ($_SERVER['SERVER_NAME'] == "www.blade-edge.com") {
      require('./blog/wp-blog-header.php');
    }
    elseif ($_SERVER['SERVER_NAME'] == "www.mseairports.com") {
      require('./mseairports/wp-blog-header.php');
    }
    elseif ($_SERVER['SERVER_NAME'] == "www.shrewsbury-gymnastics.com") {
      require('./shrewsburygym/wp-blog-header.php');
    }
    elseif ($_SERVER['SERVER_NAME'] == "archive.kerbalspace.agency") {
      require('./ksa_archive/wp-blog-header.php');
    }
    elseif ($_SERVER['SERVER_NAME'] == "www.kerbalspace.agency") {
      if (strlen($_GET["launch"])) {
        require('./ksa/wp-blog-header.php');
      } else {
        header('Location: https://www.blade-edge.com/ksaredirect.asp?' . $_SERVER['QUERY_STRING']); 
      }
    }
    ?>

    Seemingly out of the blue it not longer works, and I have no idea why. I haven’t touched this file in weeks but now if you visit the link included with my post submission you’ll see an error that the page is redirecting improperly. Where is the redirect?? I do redirect with header in one case, but not when “blade-edge.com” is in the URL. If I replace the require('./blog/wp-blog-header.php'); with echo 'WTF'; then visiting https://www.blade-edge.com/ will output “WTF” to the page. So I know everything works fine up until that point when I call for the header file using require. If I take out the ‘./blog/wp-blog-header.php’ and replace it with the full path ‘https://www.blade-edge.com/blog/wp-blog-header.php&#8217; I no longer get a redirect error but just a blank page. Interestingly, if I right-click in Firefox and choose to View Page Source it just opens a tab with another blank page. So there is some redirection going on somehow?

    I’m at a complete loss how this all broke down without me touching anything ?? My host says all they’ve done are required Windows updates to the server.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello, have you managed to fix this? Just asking because all of the above mentioned urls redirect me to different sites without issues, so no idea if this is still open or resolved ?? .

    Thread Starter gaiiden

    (@gaiiden)

    Hi, thanks for responding. The issue is still there but I worked around it and that caused the example to stop behaving improperly. I have reverted the changes for this WP site since I don’t need it up right now anyways so if you click the link now it should behave as I described with the infinite redirect. Thanks for pointing that out

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘require wp-blog-header.php for subdir install causes infinite redirect’ is closed to new replies.