WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] WordPress installation on Root Folder & Sub Folder on IIS Server, url conflict

[Resolved] WordPress installation on Root Folder & Sub Folder on IIS Server, url conflict

  • Samrat Saha
    Member

    @aaniruddhaaa

    Hello,

    I had a IIS Server hosting, where my personal site is on the root folder, and now i need to place another wordpress installation on the sub-folder, after doing so everything is working fine except when the ‘Permalink Settings’ is set to /%postname%/ in both the wp installation i.e., on the root and sub-folder then except index page of sub-folder every page is showing 404 error.

    Please Help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • 2ninerniner2
    Member

    @2ninerniner2

    This may help, especially the section on Permalinks in a sub directory installation:

    http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/install-wordpress-on-iis

    Samrat Saha
    Member

    @aaniruddhaaa

    WordPress in both root and subfolder (Windows Server IIS) with pretty permalink (/%postname%/) in both[Solved !!!]

    Web.config in Main Root Folder as you want.
    //Code—–

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
          <rules>
    	  		<clear />
    			<rule name="MainWordpressFolder" 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>

    //Important point to follow in above code
    #Add <clear /> after <rules> started…
    #<rule name=”MainWordpressFolder” will be unique in all web.config(s) of your hosting.

    Web.config in Sub Folder as you want.

    //Code—–

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
          <rules>
    	  		<clear />
    			<rule name="SubWordpressFolder" stopProcessing="true">
    				<match url=".*" />
    					<conditions>
    						<add input="{HTTP_HOST}" pattern="^(www.)?youranotherdomain.com" />
    						<add input="{PATH_INFO}" pattern="^/" negate="true" />
    					</conditions>
    				<action type="Rewrite" url="\your\sub\domain\directory\path\{R:0}" />
    			</rule>
    
    			<rule name="SubWordpressFolder-wp" 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>

    //Important point to follow in above code
    #Add <clear /> after <rules> started…
    #First <rule> needed to be defined carefully as described above.
    #Second <rule> will be generated from wordpress admin (on permalink change from settings) after generation of above rule, rename the rule name to any-unique-name-of-your-choice

    Enjoy 🙂

    galpeaceman
    Member

    @galpeaceman

    Thanks for the advise! I was truly lost with this crazy IIS stuff.
    But….. it did not work until I changed <match url=”*”/> to <match url=”.*”/> in both wp rules

    leventkaya
    Member

    @leventkaya

    @samrat Saha
    Thank you so much, your solution works on my situation.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] WordPress installation on Root Folder & Sub Folder on IIS Server, url conflict’ is closed to new replies.