1

I have a server (w2008 with iis7.5) and domain with a lot of different WP installs.

All of the following represent WP installations.

  • x.com/stuff
  • x.com/programs/recent
  • x.com/programs/asia
  • x.com/sandbox/1
  • x.com/sandbox/2
  • x.com/requests

I have been redirecting x.com to y.com for some time now - with only the WP subsites in use but would like to take off the redirect and start using the root url.

However when I install WP (fresh 3.8.1) in the root (inetpub/wwwroot) it basically breaks every website that I have. I was having various issues, from the site not coming up, to permalinks not working, to not being able to get theme files.

I tried taking out the web.config files on each install and those not coming up came up but of course the permalinks weren't working.

What are the steps I need to do to get the root working without killing the rest of the WP installs?

On one of the older WP installs that only works with the default permalink and when I set it to default in WP admin it changes the web.config to the follow:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules/>
    </rewrite>
  </system.webServer>
</configuration>

When I change the same site to year/month/name in the WP admin it sets the web.config to this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
            <rule name="wordpress" patternSyntax="Wildcard">
                <match url="*"/>
                    <conditions>
                        <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>

This totally messes up the site (doing this used to work). The site looks like it doesn't have css or correct paths plus any link needing the rewrite doesn't work. Also note that I do change the name of the rule so it doesn't conflict with other wordpress sites. So this one is wordpress_22 - I just copied what WP actually creates.

However on a WP install from last week - on same server just one directory over using year/month/postname I get a web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
            <rule name="wordpress" patternSyntax="Wildcard">
                <match url="*"/>
                    <conditions>
                        <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>

This site works perfectly fine. I can change the permalinks whatever way and they all work... riddle me that.

  • This is not a WordPress specific problem. Ask somebody who knows IIS and web.config rules instead. WordPress does not directly support IIS or web.config files, it supports Apache and .htaccess files. – Otto Apr 8 '14 at 8:38
  • @Otto - that is vehemently incorrect. Wordpress has web.config examples in their examples. There are also a few similar questions on this site. – STing Apr 8 '14 at 14:26
  • Giving examples is one thing, but the code itself only supports writing .htaccess files. I have posted example nginx configuration files to the WordPress Codex too, but the WordPress core code doesn't write nginx config files for you. My point is, that you will need to find somebody who understands IIS and web.config files to solve your problem, because it is not specifically a WordPress problem, it's an IIS configuration problem. – Otto Apr 8 '14 at 15:57
  • @Otto - WP supports IIS. I did not touch any web.config file until my sites were down. Installing WP in root caused the issue. My WP permalinks and linkage in general do not work now. Every other non WP site on the server works perfectly fine. I consider this to be a WP issue. – STing Apr 8 '14 at 16:04
  • You're misunderstanding my comment entirely. It cannot possibly be a WordPress issue if you're having issues with getting the content of those config files correct. Everything about what site comes up happens before WordPress is started or runs. If you want to solve your problem, you need to ask somebody who understands those files and how IIS works. – Otto Apr 8 '14 at 20:02
1

In each of the web.config files for each directory, they will look much like this:

<rewrite>
    <rules>
        <rule name="wordpress" stopProcessing="true">
            <match url="*" />
            <conditions>
                <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>

For each sub-site, you need to change the rule name and add a clear element. Example:

<rewrite>
    <rules>
      <clear />
        <rule name="SOME DIFFERENT NAME HERE" stopProcessing="true">
            <match url="*" />
            <conditions>
                <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>

WordPress will not do this for you because it doesn't know about any other sites on your system, and IIS configuration is very complicated. As I explained in comments, WordPress's support for IIS is extremely limited at present. You need to really write these config files yourself if you have any sort of system other than a single site configuration, and for that, you need to find an expert who knows IIS, not necessarily one who knows WordPress in particular.

  • Appreciate the help... I am very good with IIS. Rewrite are a bit of a weakness but have been doing IIS admin for years. The different rule name makes sense. What is the clear doing? – STing Apr 8 '14 at 20:21
  • The clear definitely helped a few of my WP installs right off the bat. What is funny is if I change my permalink setting wp writes over the old rule but keeps the clear - it kind of sucks because it still names the rule wordpress (they should probably go with wordpress+random number). I find it really odd that this issue cropped up only when install WP under another WP and then only on older installations. Maybe 3.8.1 is immune to these issues because of a code change. Do you think I should just redirect x.com to x.com/home to keep the nesting issue from happening? – STing Apr 8 '14 at 20:39
  • great !!! it saved my day – subashbasnet8 May 10 '17 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.