WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multisite sub-directories IIS 7.5 Redirect Loop (3 posts)

  1. mioswebdesigns
    Member
    Posted 5 months ago #

    Setting up Multisite with IIS has been a nightmare from the start, believe me if I had the choice to use Apache I would have. Okay, here goes...

    I've had multiple issues since activating Multisite, following the steps found here -> http://codex.wordpress.org/Create_A_Network

    First issue was not being able to access sub-directories, luckily I found answer here -> http://wordpress.org/support/topic/iis-cannot-access-subdirectory-site-or-dashboard

    Now biggest issue is the notorious redirect loop. Short version of problem is I can go to a sub-directory e.g. mydomain.com/dir1/wp-admin and login from there, however if I go to mydomain.com/wp-admin and try to login, I get redirect loop. Also, if I login from a sub-directory, then from Dashboard click My Sites > Network Admin > Dashboard, Sites, Users, etc... I am redirected to login page (as if it forgets I'm logged in) and I get sucked into Redirect Loop.

    Something interesting to point out - I do not get redirect loop if I'm remoted into server via RDP. It accepts my login from any site either primary or sub-directory, and I can access any part of site without it forgetting I'm logged in, which is what I want. Problem is, I'm setting up training environment for hundreds of employees, and I can't have them remoting into server box :)

    I have hunted the internet and have tried a few solutions so far, I'll also point out that I started this from a fresh install of everything, and I started Multisite with http://mydomain.com and not http://www.mydomain.com

    Here is my web.config file:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    	<system.webServer>
    		<httpProtocol>
    			<customHeaders>
    				<clear />
    				<add name="X-UA-Compatible" value="IE=edge" />
    			</customHeaders>
    		</httpProtocol>
    		<staticContent>
    			<remove fileExtension=".svg" />
    			<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    		</staticContent>
            <handlers>
                <remove name="PHP54_via_FastCGI" />
                <remove name="PHP55_via_FastCGI" />
                <remove name="PHP53_via_FastCGI" />
                <add name="PHP5_5_via_FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" />
            </handlers>
    		<rewrite>
                <rules>
                    <rule name="WordPress Rule 1" stopProcessing="true">
                        <match url="^index\.php$" ignoreCase="false" />
                        <action type="None" />
                    </rule>
                    <rule name="WordPress Rule 2" stopProcessing="true">
                        <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
                        <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
                    </rule>
                    <rule name="WordPress Rule 3" stopProcessing="true">
                        <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
                        <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
                    </rule>
                    <rule name="WordPress Rule 4" stopProcessing="true">
                        <match url="^" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAny">
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                        </conditions>
                        <action type="None" />
                    </rule>
                    <rule name="WordPress Rule 5" stopProcessing="true">
                        <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" />
                        <action type="Rewrite" url="{R:1}" />
                    </rule>
                    <rule name="WordPress Rule 6" stopProcessing="true">
                        <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                        <action type="Rewrite" url="{R:2}" />
                    </rule>
                    <rule name="WordPress Rule 7" stopProcessing="true">
                        <match url="." ignoreCase="false" />
                        <action type="Rewrite" url="index.php" />
                    </rule>
                </rules>
            </rewrite>
            <defaultDocument>
                <files>
                    <clear />
                    <add value="index.php" />
                    <add value="index.html" />
                    <add value="index.htm" />
                </files>
            </defaultDocument>
    	</system.webServer>
    </configuration>

    Here is my wp-config.php file:

    <?php
    /**
     * The base configurations of the WordPress.
     *
     * This file has the following configurations: MySQL settings, Table Prefix,
     * Secret Keys, WordPress Language, and ABSPATH. You can find more information
     * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
     * wp-config.php} Codex page. You can get the MySQL settings from your web host.
     *
     * This file is used by the wp-config.php creation script during the
     * installation. You don't have to use the web site, you can just copy this file
     * to "wp-config.php" and fill in the values.
     *
     * @package WordPress
     */
    
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'wordpress273');
    
    /** MySQL database username */
    define('DB_USER', 'xxx');
    
    /** MySQL database password */
    define('DB_PASSWORD', 'xxx');
    
    /** MySQL hostname */
    define('DB_HOST', 'localhost');
    
    /** 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', '');
    
    /**#@+
     * Authentication Unique Keys and Salts.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
     * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
     *
     * @since 2.6.0
     */
    define('AUTH_KEY',         'xxx');
    define('SECURE_AUTH_KEY',  'xxx');
    define('LOGGED_IN_KEY',    'xxx');
    define('NONCE_KEY',        'xxx');
    define('AUTH_SALT',        'xxx');
    define('SECURE_AUTH_SALT', 'xxx');
    define('LOGGED_IN_SALT',   'xxx');
    define('NONCE_SALT',       'xxx');
    
    /**#@-*/
    
    /**
     * 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_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
     * language support.
     */
    define('WPLANG', '');
    define('WP_ALLOW_MULTISITE', true);
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    $base = '/';
    define('DOMAIN_CURRENT_SITE', 'training.upsourceinc.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    /**
     * For developers: WordPress debugging mode.
     *
     * Change this to true to enable the display of notices during development.
     * It is strongly recommended that plugin and theme developers use WP_DEBUG
     * in their development environments.
     */
    define('WP_DEBUG', false);
    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIE_DOMAIN', '');
    define('COOKIEPATH', '');
    define('SITECOOKIEPATH', '');
    /* That's all, stop editing! Happy blogging. */
    
    /** 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');

    As I mentioned above, it knows my credentials are good, because if I deliberately type in wrong username/password it shows me this:
    screenshot1

    But if I user correct username/password, it just returns to login page and clears fields like this:
    screenshot2

    The URL reads:
    http://training.upsourceinc.com/wp-login.php?redirect_to=http%3A%2F%2Ftraining.upsourceinc.com%2Fwp-admin%2F&reauth=1

    If I remote into server using RDP, and login to WordPress there, I do not get redirected, and URL is the same.

    Here are my versions:

    Windows 2008 R2 datacenter 64bit
    IIS 7.5
    IIS Rewrite Module 2
    PHP Manager 1.2 for IIS 7
    MySQL Server 5.5
    MySQL Connector Net 6.5.4
    WordPress 3.8.1

  2. Have you tried deleting all cookies related to that domain?

  3. mioswebdesigns
    Member
    Posted 5 months ago #

    Yeah I had to perform a dnsflush and that did the trick. It seems typing wp-admin in URL doesn't seem to work with Multisite but using meta widget and clicking Login link which takes me to wp-login.php that works :)

Reply

You must log in to post.

About this Topic