The MU forums have moved to WordPress.org

Endless Redirect Error - also, no direct access to htaccess (11 posts)

  1. fleetadmiralj
    Member
    Posted 14 years ago #

    OK, I'm trying to install Wordpress MU on our testing domain here. However, there some issues at play which probably make this install different from most others:

    1) I'm trying to install it in a subdirectory (www.testing.example.com/wordpress_test/)

    2) I have no direct access to .htaccess since the server admins use it to control security on the server and don't want people messing with it.

    As a result, I had to send them what I wanted to go into the htaccess file, and I sent them the following:

    ------------------------------------------

    RewriteEngine On
    RewriteBase /wordpress_test/

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L] RewriteCond %{REQUEST_URI} !.*wp-content/plugins.* RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$ RewriteRule ^(.+)$ $1/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L]

    <IfModule mod_security.c>
    <Files async-upload.php>
    SecFilterEngine Off
    SecFilterScanPOST Off
    </Files>
    </IfModule>

    ------------------------------------------

    I went through the installation screen and selected the subfolder option and entered all the database information, and when I clicked to proceed, I got an error, I guess unexpectedly, which said that it wouldn't edit the .htaccess file, and said that installation was aborted.

    However, it created the wp-config file as well as database tables (though only wp_1_options appears to have any rows in it). When I try to go back to http://www.testing.example.com/wordpress_test/ I get a browser error saying "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

    I've tried clearing my cache and cookies, but it still doesn't work.

    The following is a copy of my wp_config file:

    ------------------------------------------

    /** The name of the database for WordPress */
    define('DB_NAME', 'xxxx');

    /** MySQL database username */
    define('DB_USER', 'xxxx');

    /** MySQL database password */
    define('DB_PASSWORD', 'xxxx');

    /** MySQL hostname */
    define('DB_HOST', 'xxxx');

    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');

    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');
    define('VHOST', 'no');
    $base = '/wordpress_test/';
    define('DOMAIN_CURRENT_SITE', 'testing.example.com' );
    define('PATH_CURRENT_SITE', '/wordpress_test/' );
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOGID_CURRENT_SITE', '1' );

    /**#@+
    * Authentication Unique Keys.
    *
    * Change these to different unique phrases!
    * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service}
    *
    * @since 2.6.0
    */
    define('AUTH_KEY', '60412eb3ca4b463dc4e1c5dcdface86316c582a3b92ef3b2d6d24684de7e804b');
    define('SECURE_AUTH_KEY', 'c1ab0e04d475609901e96453f517cc67097a5f9decf96871704f17443be57450');
    define('LOGGED_IN_KEY', '8f0561f1c0fe5cd0b39d198c4cad2a732f35c5c7dc3b08ee79c283fa60de7abc');
    define('NONCE_KEY', 'f052924cc3e8e229542ca091afb39c72427f469a18ac01dfb4e7c6a05c1e1e05');
    define('AUTH_SALT', '640861429330de823473d929d81aac49ca17a851d82537eb1cc30dbe64329d1e');
    define('LOGGED_IN_SALT', '5b4a314a2c735652a659bd824b3bb27346764e81ece178e93b194a73f3fa15ab');
    define('SECURE_AUTH_SALT', 'c2f194639d70324d2b3a9b10ad3aeb38f223990f6ce8577adb8b57d5308614c4');
    /**#@-*/

    /**
    * WordPress Database Table prefix.
    *
    * You can have multiple installations in one database if you give each a unique
    * prefix. Only numbers, letters, and underscores please!
    */
    $table_prefix = 'wp_';

    /**
    * WordPress Localized Language, defaults to English.
    *
    * Change this to localize WordPress. A corresponding MO file for the chosen
    * language must be installed to wp-content/languages. For example, install
    * de.mo to wp-content/languages and set WPLANG to 'de' to enable German
    * language support.
    */
    define ('WPLANG', '');

    // double check $base
    if( $base == 'BASE' )
    die( 'Problem in wp-config.php - $base is set to BASE when it should be the path like "/" or "/blogs/"! Please fix it!' );

    // uncomment this to enable wp-content/sunrise.php support
    //define( 'SUNRISE', 'on' );

    // uncomment to move wp-content/blogs.dir to another relative path
    // remember to change WP_CONTENT too.
    // define( "UPLOADBLOGSDIR", "fileserver" );

    // If VHOST is 'yes' uncomment and set this to a URL to redirect if a blog does not exist or is a 404 on the main blog. (Useful if signup is disabled)
    // For example, the browser will redirect to http://examples.com/ for the following: define( 'NOBLOGREDIRECT', 'http://example.com/' );
    // Set this value to %siteurl% to redirect to the root of the site
    // define( 'NOBLOGREDIRECT', '' );
    // On a directory based install you must use the theme 404 handler.

    // Location of mu-plugins
    // define( 'WPMU_PLUGIN_DIR', '' );
    // define( 'WPMU_PLUGIN_URL', '' );
    // define( 'MUPLUGINDIR', 'wp-content/mu-plugins' );

    // Uncomment to disable the site admin bar
    //define( 'NOADMINBAR', 1 );

    define( "WP_USE_MULTIPLE_DB", false );

    /* That's all, stop editing! Happy blogging. */

    /** WordPress absolute path to the Wordpress directory. */
    if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');

    ------------------------------------------

    I'm not sure if this is some sort of error regarding wp_config (the first time I tried to install, I originally tried editing that file directly since that's what I was used to, but got the same redirect error) or whether it's somehow a problem with .htaccess.

    Oh yeah, and this is the only wordpress install on this domain.

    Any suggestions would be appreciated

  2. andrea_r
    Moderator
    Posted 14 years ago #

    It's a problem with them not allowing WPMU to create the htaccess file on its own.

  3. fleetadmiralj
    Member
    Posted 14 years ago #

    Yeah, but at the end it has a note "If all else fails then you'll have to create it by hand" and tells you what you'd need to change, so that suggests that it should at least still work if .htaccess is even manually created correctly, at least it seems to me...

    I'm thinking of just commenting out the do_htaccess( 'htaccess.dist', '.htaccess', $base, ''); line in index-install.php file and seeing if I can get it to work then.

  4. fleetadmiralj
    Member
    Posted 14 years ago #

    OK, I did the thing of commenting out that line just to see what happened, and it appeared to finish the installation OK - it gave me a page where it gave me a username and password with a link to the login page.

    However, when I try to login, it does nothing (I'm about to go through the forum again to see if there are any useful posts on this) and when I go to the index page of the blog, I'm still getting the "the server is redirecting the request for this address in a way that will never complete" error, which makes me wonder still if either

    a) there is something amiss with my wp-config file

    b) something amiss with what I told the server people to put in the htaccess file

    c) perhaps they somehow did it wrong or put it in the wrong place?

    I can only understand that htaccess code to a point, so I can't really tell if anything is wrong with it, or what I should change it to if it is.

  5. andrea_r
    Moderator
    Posted 14 years ago #

    b & c are likely.

    Unfortunately, even though it says "If all else fails then you'll have to create it by hand", that doesn't actually work.

  6. fleetadmiralj
    Member
    Posted 14 years ago #

    OK, I installed wordpress mu in the same fashion (in a subfolder) on my own personal server and looked at it's .htaccess file and it looks like the code should be correct.

    I sent an email to the server people, and they copied what I wanted exactly into an .htaccess file in the folder, as what one is supposed to do (apparently they had added it to the root before).

    However, I'm still getting the loop. The code I gave them is, I believe, the same as above but I'll post it here again just in case:

    ------------------------------------------

    RewriteEngine On
    RewriteBase /wordpress_test/

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    <IfModule mod_security.c>
    <Files async-upload.php>
    SecFilterEngine Off
    SecFilterScanPOST Off
    </Files>
    </IfModule>

    ------------------------------------------

    As it's generating the wp-config file on it's own, I wouldn't think that's the problem, but b) and c) don't seem to be the problem either...

  7. fleetadmiralj
    Member
    Posted 14 years ago #

    Just to update people on this...it is apparently *NOT* a server or htaccess issue.

    I have narrowed down the problem somewhat, though I haven't gotten it down exactly what is causing the problem.

    Apparently when I comment out the line "do_action('template_redirect');" in wp-includes/template-holder.php, it appears to load the index page properly without reloading.

    At this point I have *not* tried to see if the site works properly nor have I seen what about template-redirect is causing the problem, but I thought I would report my progress so far.

  8. fleetadmiralj
    Member
    Posted 14 years ago #

    I think I know what is causing this particular error now.

    Our hosting server automatically redirects any site which is http://example.com to http://www.example.com. However, the code, specially the function redirect_canonical in wp-includes/canonical.php is insistent on converting any address that is http://www.example.com to just http://example.com

    There *is* an error check there to see if it is trying to redirect to the same page, but http://www.example.com and http://example.com are not equal and thus executes the code.

    The problem is that when http://www.example.com gets changed to http://example.com by the function and gets sent to the server, the server is changing it back to http://www.example.com and the function gets executed again and viola, infinite loop.

    I can't tell that there is any way to turn this "off" other than trying to comment out code as, even when I went through install and was like "yes, I want it to start with www. " it still goes through the loop.

    I'm in the process of trying to figure out, exactly, where in the code to fix it, though I'm also seeing if the host is willing to turn off the redirect for that domain too.

  9. andrea_r
    Moderator
    Posted 14 years ago #

    It woudl be a lot easier for the host to make all www requests go to the non-www, then it woudl be to crawl thru the entire codebase.

    Yes, some people have got wpmu to run with the www, but it also strips it out in some areas still

  10. fleetadmiralj
    Member
    Posted 14 years ago #

    Well, I *think* I've resolved this problem, though I don't know what side effects it might have. the hosting people said that they "had" to do things the way they did, so I just prevented redirect_canonical from accessing the do_action('template_redirect') function or whatever, and that seems to have fixed it.

  11. muhlwebdev
    Member
    Posted 14 years ago #

About this Topic

  • Started 14 years ago by fleetadmiralj
  • Latest reply from muhlwebdev