WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] backend link gives 404 error for subdirectory site (6 posts)

  1. chris_johnson0
    Member
    Posted 4 years ago #

    Hello. I seem to be having a redirection issue with a subdirectory blog site. I'm using WordPress 3.0, MySQL v5, Windows Server 2008, and IIS 7 with URL Rewrite. There is a main site and one blog subdirectory site. I can view both sites fine using pretty permalinks. When I login to the admin portion and click on the Super Admin -> Sites item, I see both sites. Hovering over the paths shows the edit link, backend link, and so forth. For the main site (path "/"), when I click on the backend link, it goes to http://server-wp/wp-admin and shows the dashboard. When I click on the backend link for the other site (path "/mikesblog/"), it goes to http://server-wp/mikesblog/wp-admin/ and displays a 404 error (file or directory not found).
    Here is my web.config file

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <defaultDocument>
                <files>
                    <add value="index.php" />
                </files>
            </defaultDocument>
    		<rewrite>
    		    <rules>
    			    <rule name="Uploaded Files" stopProcessing="true">
                        <match url="^files/(.+)" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" />
                    </rule>
    		        <rule name="Main Rule" stopProcessing="true">
    		            <match url=".*" />
    		            <conditions logicalGrouping="MatchAll">
    		                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    		                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    		            </conditions>
    		            <action type="Rewrite" url="index.php" />
    		        </rule>
    		    </rules>
    		</rewrite>
        </system.webServer>
    </configuration>

    The two rules were added to the URL Rewrite module. I'm wondering if my web.config file needs to be tweaked some more. Unfortunately, I'm not well-versed in XML or PHP programming. Everything else seems to be working fine except for that backend link. I've looked through various posts and haven't found a solution yet. Thank you for your time and assistance!

  2. MacRamsay
    Member
    Posted 4 years ago #

    I have the same problem and have been trying to solve it via my .htaccess file... no luck yet. See thread: http://wordpress.org/support/topic/420853?replies=10#post-1590469

    Where can i find this web.config file you speak of? Is it there by default or have you created it?

  3. @mac it's for Windows servers & IIS.

  4. chris_johnson0
    Member
    Posted 4 years ago #

    What should be the absolute web address path of a subdirectory blog backend link? Which PHP file should be referenced? My subdirectory blog_id=3. Thanks.

  5. the sub-blogs don't have an absolute path - they are *virtual*. they go through the exact same files in the root.

  6. chris_johnson0
    Member
    Posted 3 years ago #

    I solved the riddle! After a lot of snooping around the internet, I found an old WordPress installation page for WPMU. Here is a link.

    http://codex.wordpress.org/Installing_WPMU

    I copied the code in the IIS section and pasted it into my web.config file. Presto! The backend link now works for the subdirectory site and it fixed another problem I had with the CSS not being displayed on the subdirectory site.

    Here is the code in my web.config file.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <defaultDocument>
                <files>
                    <add value="index.php" />
                </files>
            </defaultDocument>
    		<rewrite>
    			<rules>
    				<rule name="Imported Rule 1" stopProcessing="true">
    					<match url="^(.*/)?files/$" ignoreCase="false" />
    					<action type="Rewrite" url="index.php" />
    				</rule>
    				<rule name="Imported Rule 2" stopProcessing="true">
    					<match url="^(.*/)?files/(.*)" ignoreCase="false" />
    					<conditions>
    						<add input="{URL}" pattern=".*wp-content/plugins.*" ignoreCase="false" negate="true" />
    					</conditions>
    					<action type="Rewrite" url="wp-content/blogs.php?file={R:2}" appendQueryString="false" />
    				</rule>
    				<rule name="Imported Rule 3" stopProcessing="true">
    					<match url="^(.+)$" ignoreCase="false" />
    					<conditions>
    						<!--# add a trailing slash to /wp-admin-->
    						<add input="{URL}" pattern="^.*/wp-admin$" ignoreCase="false" />
    					</conditions>
    					<action type="Redirect" redirectType="Permanent" url="{R:1}/" />
    				</rule>
    				<rule name="Imported Rule 4" 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="Imported Rule 5" stopProcessing="true">
    					<match url="^([_0-9a-zA-Z-]+/)?(wp-.*)" ignoreCase="false" />
    					<action type="Rewrite" url="{R:2}" />
    				</rule>
    				<rule name="Imported Rule 6" stopProcessing="true">
    					<match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
    					<action type="Rewrite" url="{R:2}" />
    				</rule>
    				<rule name="Imported Rule 7" stopProcessing="true">
    					<match url="." ignoreCase="false" />
    					<action type="Rewrite" url="index.php" />
    				</rule>
    			</rules>
    		</rewrite>
        </system.webServer>
    </configuration>

    I hope this helps someone else using WordPress 3 and IIS 7. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic