Double index.php problem | Poiesis Web Development

WordPressWe’ve recently upgraded our WordPress installation to WordPress 2.8 and realized just why I hate upgrading WordPress! On the 2.7.1 version the NEXT POSTS / PREVIOUS POSTS link at the bottom of the page worked perfectly, but after the upgrade it pointed erroneously to http://www.poiesis.co.za/index.php/Index.php/page/2/. I’m sure you can see the problem there: the double index.php in the URL! The solution to the problem is simple: open the formatting.php in wp-includes and add the following line in the function clean_url after the if ('' == $url) return $url; statement:

$url = str_replace('index.php/Index.php','index.php',$url);

The only problem is you need to remember to add the line again every time you upgrade WordPress.

Tags: ,

2 Responses to "Double index.php problem"

  1. berkem ceylan [December 29th, 2009 at 7:46 pm]

    I couldn’t do this. Where should I place to code?

  2. Brent [June 14th, 2010 at 8:24 am]

    After the if ('' == $url) return $url; statement. Something like this:

    function clean_url( $url, $protocols = null, $context = 'display' ) {
    $original_url = $url;

    if ('' == $url) return $url;
    $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
    $strip = array('%0d', '%0a', '%0D', '%0A');
    $url = _deep_replace($strip, $url);
    $url = str_replace(';//', '://', $url);
    $url = str_replace('index.php/Index.php','index.php',$url);


Leave a reply