[wp-trac] [WordPress Trac] #34672: Redirect Loop in redirect_canonical because of port
WordPress Trac
noreply at wordpress.org
Fri Nov 13 07:28:47 UTC 2015
#34672: Redirect Loop in redirect_canonical because of port
--------------------------+-----------------------------
Reporter: AbdealiJK | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.3.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
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 :
- `$redirect_url` as 'http://localhost:80/ajk/' and
- `$requested_url` as 'http://localhost/ajk/'
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' );`
4. Now, I copied `/var/www/html/ajk/wordpress/wp-content` to
`/var/www/html/ajk/wp-content`
5. Create `/var/www/html/ajk/wp-config.php` with :
{{{#!php
<?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');
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34672>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list