Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#34672 closed defect (bug) (duplicate)

Redirect Loop in redirect_canonical because of port

Reported by: abdealijk's profile AbdealiJK Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3.1
Component: Canonical Keywords:
Focuses: Cc:

Description

I found a few issues which seemed similar (33821, 17718, etc) but the patches given there do not fix my problem.

The problem :
I am able to open wp-admin and everything works well.
When I open my home page, I get a redirect loop.
On further investigation, it seems redirect_canonical() in wp-includes/canonical.php is the culprit. It finds the :

And the extra :80 causes the condition $redirect_url == $requested_url to be false - causing the infinite redirect.

Detailed steps to reproduce error :
So, I have set up wordpress by doing the following:

  1. Made a empty git repo in the folder /var/www/html/ajk (Using Ubuntu 14.04 + Apache)
  2. Added submodule at /var/www/html/ajk/wordpress using git and checked out 4.3.1 branch
  3. Copied /var/www/html/ajk/wordpress/index.php to /var/www/html/ajk/index.php

In this file, I changed require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' ); to require( dirname( __FILE__ ) . '/wp-blog-header.php' );

  1. Now, I copied /var/www/html/ajk/wordpress/wp-content to /var/www/html/ajk/wp-content
  1. Create /var/www/html/ajk/wp-config.php with :
<?php
$server_name = $_SERVER['SERVER_NAME'];
$server_port = $_SERVER['SERVER_PORT'];
$doc_root = $_SERVER['DOCUMENT_ROOT'];
$subdir = '/ajk';
$http = 'http://';

define('WP_SITEURL', $http . $server_name . ':' . $server_port . $subdir
    . '/wordpress');
define('WP_HOME', $http . $server_name . ':' . $server_port . $subdir);
define('WP_CONTENT_DIR', $doc_root . $subdir . '/wp-content');
define('WP_CONTENT_URL', $http . $server_name . ':' . $server_port . $subdir
    . '/wp-content');

define('DB_NAME', 'db_wp');
define('DB_USER', 'root');
define('DB_PASSWORD', '1');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

define('WP_DEBUG', true);


/**#@+
 * 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',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',       'put your unique phrase here');

/**#@-*/

$table_prefix  = 'wp_';

/* 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');

Change History (1)

#1 @swissspidy
9 years ago

  • Component changed from General to Canonical
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there and welcome to trac!

Even if a patch on a ticket doesn't solve your issue, it doesn't necessarily mean you should create a separate ticket. Instead, I'd recommend you to post your findings to #33821, which already deals with redirect loops caused by ignored ports in redirect_canonical().

Note: See TracTickets for help on using tickets.