WordPress 3.0.1 Install on MS IIS v6 Web Server - wordpress

I have just installed WordPress 3.0.1 running on MS IIS 6 Windows Server that I developed from my Mac OS X platform.
Note that my WordPress setup is under the following directory structure:
c:\inetpub\wwwroot\MYSITE
The problem here is though, with the site up and running, it can't seem to find any of my pages like "About Us" even though I have set them up correctly within the permalinks side of things.
I am getting:
HTTP Error 404 - File or directory not found. Internet Information Services (IIS)
Is it something to do with permalinks/.htaccess file not working on MS II6?

.htaccess files are for Apache HTTPD. They don't work with IIS. For IIS you need to create a "Web.config" file and add the following lines to it.
<rewrite>
<rules>
<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>
DOESN'T WORK IN IIS6:
As Kev points out, this code doesn't work in IIS6. From a little googling I understand that URL rewriting is not at all possible with IIS6. If anyone knows another way, please update here.
POSSIBLE ALTERNATIVE FOR IIS6?
Is it possible to use ISAPI_Rewrite or UrlRewriter.NET in this situation? Can someone clarify on this?

Related

Wordpress permalinks URL rewrite uses up 100% CPU - Redirect Loop?

I'm hosting multiple Wordpress websites on a windows 2016 server, IIS 10. As if by random one site started using up 100% CPU resources. We added more CPU's and same issue.
We stopped the site, made a complete copy of files and databases and then created the site again on a new DNS entry. The site runs fine.
Back to the faulty site - eventually we found that if we disabled the url rewrite for permalinks in IIS, the site worked fine. Turn this on again - maxes out resources straight away.
The rewrite rule is below - it is the same as multiple others on the others, but when this is implemented, it crashes the server? There seems to be some constant redirect going on, but im stumped now...where to look next?
<rewrite>
<rules>
<rule name="WordPress: https://myfaultywebsite.com" enabled="false" 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>

Why is IIS stripping web page extensions all of a sudden?

This morning I pushed a new .Net web site (fw 4.6.1, previously 4.5.1) out to production. IIS (I assume) stripped the extensions from all web pages (ie. index.aspx just became index). I've had these web sites running for 8+ years using IIS rewrites. It looks like then IIS saw the "extensionless" web pages, the rewrite kicked in and sent it to a non-existent location, producing a 404.
I also did a Windows update 3 days ago (could have missed this issue since but unlikely). The rewrite rule basically says, if you can't find the page, look for the page in the "Clients" subdirectory. The rule looks like:
<rewrite>
<rules>
<rule name="Client Relocation" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" negate="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="Clients/{R:0}" />
</rule>
</rules>
</rewrite>
I was able to work around the issue by removing the rewrite rule in a subdirectory:
<rewrite>
<rules>
<remove name="Client Relocation" />
</rules>
</rewrite>
So, it would appear the extension was stripped, then IIS gets the page and thinks it doesn't exist so the rewrite rule takes effect.
So, my question is: who/what is stripping the extension and how can I stop it from doing so?
Lex Li put me on the right track with the comment about the application and failed request tracing. Turned out to be the App_Start/RouteConfig.cs file got modified and added:
var settings = new FriendlyUrlSettings();
settings.AutoRedirectMode = RedirectMode.Permanent;
routes.EnableFriendlyUrls(settings);
Not exactly sure how or why but commenting out the AutoRedirectMode put the extensions back on. If I could give the answer to Lex's comment, I would have.

running site on IIS server gives an error

I'm uploading my site on IIS server and then it gives an error 500(Internal Server Error), when i'm trying to create new user.
But the same code is perfectly run on localhost.
I think the error is because of web.config file.
I'm using Apache server on local machine. for hosting I'm using IIS server.
here is my web.config file code :
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
please help me,
thanks in advance.
You have to install URL Rewrite on the IIS server.
STEPS:
Logon to the IIS server (either; console or RDP).
Download the MSI installer file the corresponds to your server's platform; x86 or x64.
Double-click on the MSI installer file. The installation wizard should walk you though the steps.
Once you're done, try to reload the site from your browser.
You may need to install the URL Rewrite module via Microsoft Web Platform installer first. After that, select the website/application in question and it will appear within the 'Features view' of IIS. You can then set it up as needed.

W3 Total Cache IIS minify error

My Problem
I am getting an error trying to minify URLs using the Wordpress plugin W3 Total Cache with IIS.
W3 Total Cache error:It appears Minify URL rewriting is not working.
Please verify that the server configuration allows .htaccess
Unfortunately minification will not function without custom rewrite
rules. Please ask your server administrator for assistance. Also refer
to the install page for the rules for your server. Technical info
.htaccess file contains rules to rewrite url
http://myurl.com/:\Web\Public_Test2/wp-content/cache/minify/000000/w3tc_rewrite_test.
If handled by plugin, it returns "OK" message. The plugin made a
request to
http://myurl.com/:\Web\Public_Test2/wp-content/cache/minify/000000/w3tc_rewrite_test
but received: Connection timed out after 2016 milliseconds instead of
"OK" response.
(note: I edited the domain name for privacy) I find the URL to be quite odd having the domain in there but I do not know how to change the default URL it tests. If coming from the main directory it is indeed Web/Public_Test2/wp-content/cache/minify but there is no 000000 folder in there.
W3 Total Cache Recommendations
Under the install tab for the plugin there is a note for people not using apache:
In the case where Apache is not used, the .htaccess file located in the root directory of the WordPress installation, wp-content/w3tc/pgcache/.htaccess and wp-content/w3tc/min/.htaccess contain directives that must be manually created for your web server software.
However, a w3tc folder does not exist, only a w3tc-config folder which has a master.php and master-admin.php file, no .htaccess or subfolders. I checked a cache folder under wp-config and there is no .htaccess in any subfolder. So I am not sure how to change the web.config or with what directives.
My Attempt
I found somewhere suggesting that these rewrite rules be added to web.config, I added them but it did not change the error at all:
<rule name="w3tc_rewrite_test" stopProcessing="true">
<match url="^wp-content/cache/minify/000000/w3tc_rewrite_test" />
<action type="Rewrite" url="wp-content/plugins/w3-total-cache/pub/minify.php?w3tc_rewrite_test=1" logRewrittenUrl="true" />
</rule>
<rule name="w3tc-minify-test-file" stopProcessing="true">
<match url="wp-content/cache/minify/(.+/[X]+\.css)$" />
<action type="Rewrite" url="wp-content/plugins/w3-total-cache/pub/minify.php?test_file={R:1}" />
</rule>
<rule name="w3tc-minify-file" stopProcessing="true">
<match url="wp-content/cache/minify/(.+\.(css|js))$" />
<action type="Rewrite" url="wp-content/plugins/w3-total-cache/pub/minify.php?file={R:1}" />
</rule>
I ran into the same issue and here is the solution that worked for me:
W3 Total Cache: Version 0.9.4.1
Wordpress: Version 4.5.2
IIS: Version 7.5
Server: Windows 2008 R2
My web.config has these rules:
<rewrite>
<rules>
<clear />
<rule name="w3tc-minify-file" stopProcessing="true">
<match url="wp-content/cache/minify/(.+\.(css|js))$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="wp-content/plugins/w3-total-cache/pub/minify.php?file={R:1}" />
</rule>
<rule name="wordpress" enabled="true" patternSyntax="Wildcard">
<match url="*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<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>
When I put the w3tc-minify-file rule under my wordpress rule, it did not work and I was getting 404 errors on all of the minify files W3TC was creating.
I'm using manual mode minify and just combining my css and js files and it's working great. Hope it helps someone.
The chances of this working with the auto minify mode are very low, so I definitely recommend doing the manual mode for the highest chance of success. I had 3 JS files and 2 CSS files I could not combine/minify because they broke my site. Manual mode gives you the most control, so spend a bit of time adding each file until you have it as best as you can.

MVC3 + WordPress IIS Url Rewriting Rules

I have a ASP.NET MVC3 website located at http://mydomain.com/mymvcapp/. However, the root of the webiste (mydomain.com) contains a WordPress site running PHP. Therefore, I put the following IIS URL Rewrite rule to allow WordPress to function correctly via its rewriting mechanisms:
<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>
So with this rule in place my WordPress functions perfectly, however, my MVC rewriting does NOT work. How would I alter this rule to allow both WordPress and MVC (under the /mymvcapp/ folder) to coexist nicely?
Figured it out on my own. Regex is probably one of the most powerful YET complicated / confusing technologies there is. But in this case the patternSyntax flag was set to Wildcard, not Regex, which caused my confusion. Hope this helps someone else out there! =]
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*" />
<conditions logicalGrouping="MatchAll">
<add input="{PATH_INFO}" pattern="/mymvcapp/*" negate="true" />
<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>
This is one of the very few posts anywhere that talks about making WordPress and ASP.NET coexist nicely in an IIS setup. So Kudos for that.
I was thinking to post this as comment to either your original question or the answer, but I chose to write an "answer" only because this is an honest question and I need some formatting capabilities.
I have multiple ASP.NET apps running on by site. In particular the root website is running an MVC4 app.
Since I cannot have WordPress installed at the root, my plan was to have it on its own app folder http://mydomain.com/wordpress/ and then have a URL-rewrite rule that to do the following (using peudo-code):
blog.mydomain.com/{path} --> mydomain.com/wordpress/{path}
I've only caused a mess with this approach and have not been successful using pretty permalinks, sometimes getting into redirect-loops and other times breaking links to .css files, admin pages, etc...
Have you ever given this a thought, i.e., having wordpress as a subapp instead and do sub-domain URL-rewriting?!?!
I had a similar situation but I had no need to edit my web.config file. Instead I followed instructions here at https://wordpress.org/support/article/giving-wordpress-its-own-directory/ where this is documented.
At point 7) within Moving WordPress process to a subfolder Method II (With URL change) you find options for a IIS installation.

Resources