WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WordPress in sub-folder but won't appear and seems to auto-redirect to root (6 posts)

  1. davetoliver
    Member
    Posted 5 years ago #

    I've set up a number of WordPress installs without any issues. My latest one is throwing me for a loop. I've installed WP in this subfolder http://www.cleanenergy4america.org/wordpress

    When I go to that page, it kicks me out to the root... http://www.cleanenergy4america.org But the blog is there because I can get to it through http://www.cleanenergy4america.org/wordpress/?p=1

    I've never seen this issue before. It happened after I upgraded to v2.6. I tried changing index.php and adding the subdirectory there just in case, and no luck.

    Help please! Thanks in advance!

  2. maestro42
    Member
    Posted 5 years ago #

    In the settings page - where it says to type in the address of your blog is it written as:

    http://www.cleanenergy4america.org -or- http://www.cleanenergy4america.org/wordpress

    (it should be the latter)

    Let's start there.

  3. davetoliver
    Member
    Posted 5 years ago #

    It's definitely the latter. I've double checked that. Both the WP address and Blog address are the latter. I even tried making it something different and putting the index.php in a different directory and nothing changed it.

  4. davetoliver
    Member
    Posted 5 years ago #

    Don't know if this helps, but I did a server head test and the response was:

    #1 Server Response: http://www.cleanenergy4america.org/wordpress/
    HTTP Status Code: HTTP/1.1 301
    Date: Tue, 05 Aug 2008 12:35:23 GMT
    Server: ConcentricHost-Ashurbanipal/1.8 (XO(R) Web Site Hosting)
    Location: http://www.cleanenergy4america.org/
    Content-type: text/html;
    Connection: close
    X-Powered-By: PHP/4.4.7
    X-Pingback: http://www.cleanenergy4america.org/wordpress/xmlrpc.php
    Redirect Target: http://www.cleanenergy4america.org/

    So it's redirecting for some reason, but I don't know exactly what all of this means.

  5. davetoliver
    Member
    Posted 5 years ago #

    Just FYI, for all those who use XO hosting... here's the fix they gave us:

    In the wp-settings.php file, replace

    // Fix for IIS, which doesn't set REQUEST_URI
    if ( empty( $_SERVER['REQUEST_URI'] ) ) {

    // IIS Mod-Rewrite
    if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
    $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
    }
    // IIS Isapi_Rewrite
    else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
    $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
    }
    else
    {
    // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
    if ( isset($_SERVER['PATH_INFO']) ) {
    if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
    $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
    else
    $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
    }

    // Append the query string if it exists and isn't null
    if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
    $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
    }
    }
    }

    // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
    if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) )
    $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];

    // Fix for Dreamhost and other PHP as CGI hosts
    if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
    unset($_SERVER['PATH_INFO']);

    with...

    if(isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
    $_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
    } else {
    $_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF'];
    }

  6. camu
    Member
    Posted 5 years ago #

    This helped me to solve a similar issue with the sun java webserver 7 (SAMP environment using the Cool Stack package). Thank you very much guys!

Topic Closed

This topic has been closed to new replies.

About this Topic