Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Problem Issue Error WordPress IIS: The page isn’t redirecting properly

WordPress IIS: The page isn’t redirecting properly

From last post, I choose WordPress because it works properly on both Linux and Windows. However, after installed it on IIS Windows Server 2003, I could access the admin portal (Dashboard) but when I went to the homepage, I got this error message in few seconds: “The page isn’t redirecting properly”

Wordpress IIS

Wordpress IIS

It’s so strange because I’ve installed WordPress so many times on both Windows and Linux, but in this morning, I installed the latest version of WordPress (3.1.1) and the issue “Redirecting Loop” occurred. It’s not a problem with the current server as it run properly with the previous version and with the latest version, I can access the Dashboard.

I googled a lot I found an article on WordPress Support: http://wordpress.org/support/topic/windows-server-infinite-redirect-after-upgrading-to-31/page/3 that help me fix the issue.

Basically, we need to make some changes in the redirect_canonical() function in the wp-includes/canonical.php file.

The original redirect_canonical() function content:

[php] function redirect_canonical( $requested_url = null, $do_redirect = true ) {
global $wp_rewrite, $is_iis7, $wp_query, $wpdb;

if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_iis7 && !iis7_supports_permalinks() ) )
return;

if ( !$requested_url ) {
// build the URL in the address bar
$requested_url = is_ssl() ? ‘https://’ : ‘http://’;
$requested_url .= $_SERVER[‘HTTP_HOST’];
$requested_url .= $_SERVER[‘REQUEST_URI’];
}
.
.
.
.
[/php]

Need to be changed likes below:

[php highlight=”7.8,9,10″] function redirect_canonical( $requested_url = null, $do_redirect = true ) {
/*global $wp_rewrite, $is_iis7, $wp_query, $wpdb;

if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_iis7 && !iis7_supports_permalinks() ) )
return;*/

global $wp_rewrite, $is_IIS, $is_iis7, $wp_query, $wpdb;

if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) )
return;

if ( !$requested_url ) {
// build the URL in the address bar
$requested_url = is_ssl() ? ‘https://’ : ‘http://’;
$requested_url .= $_SERVER[‘HTTP_HOST’];
$requested_url .= $_SERVER[‘REQUEST_URI’];
}

$original = @parse_url($requested_url);
if ( false === $original )
return;
.
.
.
.
[/php]

Note: if you upgrade your WordPress to a new version in the future, the file will be overwritten, so please keep in mind to check & update again.

Apr 7, 2011Hoan Huynh
My Google Adsense Ad has been disabledService, Tool To Create, Generate Your Favicon .ico Online
You Might Also Like:
  • PHP Get Current Web Page URL
  • Show Error Message On WordPress Custom Login Template Page
  • Add And Get Custom Field In WordPress
  • WordPress View Large Image Without Leaving Current Page
  • Excerpt box disappeared on WordPress New Version
  • Add WordPress Login Form On Sidebar Or Custom Page
  • Place Facebook Like Button On WordPress
  • How To Change Default Home Page Of WordPress
  • How To Configure Friendly URL For WordPress Hosted On IIS
  • Get WordPress Short Link And Full Link To A Post
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

11 years ago Problem Issue Errorredirect_canonical, Wordpress348
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
24,451 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
21,829 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
17,646 views
JQuery Allow only numeric characters or only alphabet characters in textbox
14,984 views
C# Read Json From URL And Parse/Deserialize Json
11,710 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Things to Learn about Installingderm Loan Type S
  • Online Photo Editor – Free Photoediting Software
  • A Guide to Finding the Best Paper Sellers
  • Photoediting in Home Isn’t Hard to Do!

  • Free Photo Editor Online
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (27)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (647)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development