WordPress multisite urls fails, WordPress seem to redirect incorrectly

33 views Asked by At

I am aware this question has been posted previously but the answers do not solve my problem.

when setting in wp_config file is like so:

define( 'PATH_CURRENT_SITE',  '/wordpress/' );

links to network admin (http://localhost/wordpress/wp-admin/network/) and main site (localhost/wordpress ) work but other sites fail, for example localhost/wordpress/anothersite

if I change setting in wp_config.php with an xtra forward slash like so

define( 'PATH_CURRENT_SITE',  '//wordpress/' );

only the link to network admin (http://localhost/wordpress/wp-admin/network/) fails but all site url work

I believe there is a problem with the web.config file but do not know how to configure it:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="WordPress Rule 1" stopProcessing="true">
                    <match url="^index\.php$" ignoreCase="false" />
                    <action type="None" />
                </rule>
                <rule name="WordPress Rule 2" stopProcessing="true">
                    <match url="^wordpress/([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
                    <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
                </rule>
                <rule name="WordPress Rule 3" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                    </conditions>
                    <action type="None" />
                </rule>
                
                <rule name="WordPress Rule 4" stopProcessing="true">
                    <match url="^wordpress/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
                    <action type="Rewrite" url="wordpress/{R:1}" />
                </rule>
                <rule name="WordPress Rule 5" stopProcessing="true">
                    <match url="^wordpress/([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                    <action type="Rewrite" url="wordpress/{R:2}" />
                </rule>
                <rule name="WordPress Rule 6" stopProcessing="true">
                    <match url="." ignoreCase="false" />
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>


0

There are 0 answers