My proposed redirect is this;
` <rule name=”test” stopProcessing=”true”>
<match url=”^/category/name-of-category/$”/>
<conditions>
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true”/>
<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true”/>
</conditions>
<action type=”Redirect” url=”https://www.name-of-website.co.uk/particular-page.asp”/>
</rule>
I’ve spent days reading different suggestions related to this (I believe common) issue.. but so far I haven’t found a solution.
I changed my site to the ‘pretty’ permalinks (post name), and as I’m on a windows server, it caused configuration problems: “404 – File or directory not found”.
Following this, my hosting provider added a web.config file for me, which has resolved the problem of the links on my site, however in doing so, it has blocked access to the image files, so my site now displays no images.
It seems I can either have one or the other – pretty permalinks or images.
This is the code in the web.config:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" 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>
Where am I going wrong?!
Thanks in advance!!
G
]]>I did find a workaround– I think. I have altered the REGEX in the web.config’s rule, so it has no effect, but the file remains and hopefully won’t be overridden. I have some concern that I have just defeated some security measures.
I don’t know yet if this is the WP core or a plugin or theme code itself is writing this file. It really messes things up.
Bob
]]>That way I can create all my multisites sites and their urls would be like:
https://www.mywebsite.com/sites/test-site-1
https://www.mywebsite.com/sites/test-site-2
I think it’s possible and its only a matter of configuring the web.config. By default, WP provides the following and to put these rules in /sites/web.config:
<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="^sites/([_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="^sites/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
<action type="Rewrite" url="sites/{R:1}" />
</rule>
<rule name="WordPress Rule 5" stopProcessing="true">
<match url="^sites/([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
<action type="Rewrite" url="sites/{R:2}" />
</rule>
<rule name="WordPress Rule 6" stopProcessing="true">
<match url="." ignoreCase="false" />
<action type="Rewrite" url="index.php" />
</rule>
Which I think is close, but its assuming that the website may be in root? Putting the rules in /sites/web.config appears to make no difference. So I’ve been putting the rules following modified rules within the root web.config. Here’s my modification but still not working.
<rule name="WordPress Rule 1" stopProcessing="true">
<match url="^sites/index\.php$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="WordPress Rule 2" stopProcessing="true">
<match url="^sites/([_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="^sites/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
<action type="Rewrite" url="sites/{R:1}" />
</rule>
<rule name="WordPress Rule 5" stopProcessing="true">
<match url="^sites/([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
<action type="Rewrite" url="sites/{R:2}" />
</rule>
<rule name="WordPress Rule 6" stopProcessing="true">
<match url="sites/." ignoreCase="false" />
<action type="Rewrite" url="sites/index.php" />
</rule>
I can get to the Multisite dashboard and everything within the admin is working for /sites/ but I’m not able to see the website of websites (test-site-1 and test-site-2) I created nor access their dashboard.
I’m doing this on Azure, but it would be similar to IIS if not the same. I can also confirm that there is no rules conflict with any other rules.
Any help would be appeciated
]]>Does anybody know the web.config equivalent for the .htaccess ‘SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1’?
My WordPress website is hosted on a Windows server.
Grtz Patrick
]]>I have bumped them a couple of times in stting>permalinks but nothing has changed
There is a notice in the dash board about web.config needing to be updated, but neither I nor the host seems to know how to do that – should wordpress do this itself much as it does .htaccess
In any case this is the web.config file. Can any one help truble shoot 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>
<rule name=”Plesk. WordPress redirect wpConfigRule #73145cbb-5261-473c-b6c7-d9fd3123fbe2″ stopProcessing=”true”>
<match url=”^wp-config.php$” ignoreCase=”false” />
<action type=”CustomResponse” statusCode=”403″ statusReason=”Forbidden” statusDescription=”Forbidden” />
</rule>
<rule name=”Plesk. WordPress redirect wpContentRule #443a2663-c0ef-4391-8f1c-1618e5cd9f05″ stopProcessing=”true”>
<match url=”^wp-content/.+\.php$” ignoreCase=”false” />
<action type=”CustomResponse” statusCode=”403″ statusReason=”Forbidden” statusDescription=”Forbidden” />
</rule>
<rule name=”Plesk. WordPress redirect wpIncludesRule #fd6af2e7-29db-4137-94fb-69b50b43e527″ stopProcessing=”true”>
<match url=”^wp-includes/.+\.php$” ignoreCase=”false” />
<action type=”CustomResponse” statusCode=”403″ statusReason=”Forbidden” statusDescription=”Forbidden” />
</rule></rules>
</rewrite>
<directoryBrowse enabled=”false” />
</system.webServer>
</configuration>
I’m currently trying to improve the speed of our new website (https://www.onboardtracker.com/) and W3 Total Cache plugin brakes it every time I am trying to switch it on (it will work for 5 minutes and then… blank page). I found some articles saying that W3 Total cache is designed to automatically edit htaccess file (which is fine) but not the web.config. And here is my question: how to configure W3 Total Cache on IIS? How the web.config file should look like and what should it include?
Note: the website is using WordPress 4.9.2 version and running on PH Version: 7.0.25.
Any hints will be highly appreciated!
]]>Most sites are saying to update and save permalinks and that will force creation but when I do that it is telling me “You should update your web.config now”. I tried to manually create php.ini, .htaccess, and web.config files and placed them at various levels individually to test to see if they were picking up but weren’t. Any suggestions how to proceed? I’ve been stuck on this for a week and have ran out of pages of Google to click on.
]]>I have a large and well-established ASP site that I am hoping to retire gradually, all of whose internal links are relative. I intend to create a new WP site that will be the first port of call, with a link “if you want the old site, link“. I can install WP in a wordpress subdirectory and set it up so that calls to the default page are redirected to the new site.
But I’m concerned that if anyone follows a link outside the subdirectory (to a root file like index.asp or files in other directories at the same logical level as wordpress) it may be caught and redirected to 404.
Short of trying it out and risking screwing up, can any experts shed light on this for me please before I embark on development?
TIA
]]>