Mo Frank Hu
Mo Frank Hu

Reputation: 33

WordPress redirecting after IIS reverse proxy

I'm setting up a WordPress site. We uses IIS reverse proxy at our main server and set a wampserver locally for the website.

The problem is that most pages (except the main page) can't be accessed through the proxy. It says ERR_TOO_MANY_REDIRECTS in Chrome (similar result in Safari).

I'm new to WordPress and not sure what happens, I guess details may be needed to find the problem:

  1. The local link (local IP address, e.g.: 1.2.3.4/iac/introduction) works for all pages.
  2. Adding preview argument for all pages (e.g.: www.sitename.com/iac/introduction/?preview=true) make it accessable; The search page (www.sitename.com/iac/?s=) also works.
  3. Our reverse proxy was set as follow: enter image description here
  4. WordPress site options in the wp-admin page enter image description here
  5. .htaccess on the /iac/ folder

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    
  6. index.php

    <?php
    /**
     * Front to the WordPress application. This file doesn't do anything, but loads
     * wp-blog-header.php which does and tells WordPress to load the theme.
     *
     * @package WordPress
     */
    
    /**
     * Tells WordPress to load the WordPress theme and output it.
     *
     * @var bool
     */
    define('WP_USE_THEMES', true);
    
    /** Loads the WordPress Environment and Template */
    require( dirname( __FILE__ ) . '/wp-blog-header.php' );
    
  7. folder tree

I tried to put the WordPress folder in either www/ or www/iac/, but neither worked.

I'm not sure what is wrong in my WordPress or proxy settings. All suggestions and advices are welcomed. Thanks!

Frank

Upvotes: 0

Views: 628

Answers (1)

Mo Frank Hu
Mo Frank Hu

Reputation: 33

Finally I got an dirty answer: comment template_redirect related codes in wp-includes/template-loader.php

Note that some minor redirect error may appear in wp-admin, but the main site works well.

//if ( defined('WP_USE_THEMES') && WP_USE_THEMES )
/**
 * Fires before determining which template to load.
 *
 * @since 1.5.0
 */ 
//  do_action( 'template_redirect' );

another way I found is edit functions.php:

remove_action(‘template_redirect’, ‘redirect_canonical’);

Seems a much clearer solution (without changing wp's main folder), but it didn't work in my case :(

Upvotes: 1

Related Questions