• Resolved mdj101

    (@mdj101)


    Recently migrated my sisters website to a newer server, both old and new were running IIS.

    Had some issues with permalinks on the new server but got this resolved and all has been fine for the last few weeks.

    Then the last couple of days i’ve noticed the following at the top of some of the admin pages.

    Warning: stripos() [function.stripos]: needle is not a string or an integer in D:\vhosts\.com\httpdocs\wp-includes\functions.php on line 658
    
    Warning: stripos() [function.stripos]: needle is not a string or an integer in D:\vhosts\.com\httpdocs\wp-includes\functions.php on line 661

    This appears to be related to an old ISAPI Rewriter plugin which made permalinks work using ISAPI Rewrite 3, however I don’t need this on the new server as it has built in rewrite.

    HOWEVER. If I disable the plug in I get a 404 error for the home page, all other permalinks work fine.

    Here is the contents of the ISAPI plug in.

    <?php
    /*
    Plugin Name: ISAPI Rewriter
    Plugin Author: Andy Stratton
    Plugin URI: http://theandystratton.com/
    Version: 1.0
    Description: This plugin enables WordPress' Permalink functionality when redirecting URL's on a Windows Server with ISAPI Rewrite 3.
    Use WordPress' default .htaccess file.
    */
    
    add_action('init','__isapi_rewriter_init');
    function __isapi_rewriter_init(){
    	$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
    }

    And the .htaccess

    # You should be able to use this as a .htaccess file
    # with ISAPI Rewrite 3.0
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* /index.php [L]

    My web.config contains the following

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <clear />
                    <rule name="Imported Rule 1" enabled="true" stopProcessing="true">
                        <match url="^index.php$" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Redirect" url="/" redirectType="Permanent" />
                    </rule>
                    <rule name="Imported Rule 2">
                        <match url="^(.*)/$" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                            <add input="{URL}" pattern="/wp-admin" ignoreCase="false" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="/index.php/{R:1}" />
                    </rule>
                    <rule name="Imported Rule 3" stopProcessing="true">
                        <match url="^(.*)/index.php$" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                        <action type="Redirect" url="/{R:1}/" redirectType="Permanent" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>

    I can’t work out why all the other pages would work but not the index.php.

    Any ideas would be much appreciated.

Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘404 but only on index.php all others work fine’ is closed to new replies.