WordPress IIS URL Rewrite to a subdirectory
-
I have multiple domains pointing to our hosting account. Each domain is tied to a subdirectory with a wordpress installation. We are on Go Daddy Windows hosting. No we cannot switch to Linux.
My problem seem to be with my web.config file. I have tried the standard rewrite 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>
It seems to work for most of the permalinks, but I have areas that when I click a link the URL shows up as https://MY_DOMAIN.com/MYSUBFOLDER/(then rest of URL)
Anyone have any suggestions of rewriting those URL’s that are coming through with the subfolder?
This is primarily happing within the admin panel.
One place to see what is going on is at:
https://krazyclippers.com/wp-admin
Notice the redirect_to URL, it includes the SUBFOLDER in it. That behavior occurs in multiple places within the admin panel. I suspect it’s an issue with trailing backslashes. I have tried this rule:
<rule name="Host Directories Fix" stopProcessing="true"> <match url="^(.*)[^/]$" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_HOST}" pattern="^krazyclippers.com\.com$" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" /> </conditions> <action type="Redirect" url="https://krazyclippers.com/{R:0}/" redirectType="Permanent" /> </rule>
This fixes the “/” on wp-admin but does not fix the other occurrences within the admin panel.
Anyone see any issues with this rule on why it would not work in all cases OR is there potentially another RULE that I need to remove the SUBFOLDER names from the URL’s?
Thankyou,
- The topic ‘WordPress IIS URL Rewrite to a subdirectory’ is closed to new replies.