Tuesday, April 29, 2014

WordPress Multiple Install IIS URL Rewriting Problems

Okay...  This has given me a gigantic headache (both figuratively and literally) all morning and thank goodness I've finally managed to hack a solution to it...  Technically it isn't a hack, but it sure smells like one.

We have an unusual situation where sales & marketing has its own WordPress installation at the root of our website and the support group has its own separate installation under /support.

The web server that we're currently using is an IIS 7 server, which means that WordPress is operating with no .htaccess files and using web.config.  Each base directory has a web.config.  Each WordPress is using its own Database and has its own database user.

So...  Problems arose when enabling permalinks (pretty ones) for the support site.  I couldn't figure out why going to any of the site pages was yielding a 404 error (emitted by WordPress' PHP.)

My hosting provider couldn't figure it out either - which really got me worried, so after slogging around endlessly, and reading about all the other people using multiple installs and having minor configuration issues, I really started to pull my hair out lol...  I then ran across an obscure post about a guy mentioning WordPress and ASP.NET configuration inheritance issues.  This led me to other posts about nested ASP.NET applications issues, which ultimately led me to the following magic:

<location path="." inheritInChildApplications="false">

Thanks to the wonderful person found at:

http://articles.runtings.co.uk/2010/04/solved-breaking-parent-webconfig.html

Basically, IF you have a WordPress installation in a sub-directory of your website that is hieararchically a child of another WordPress installation, and you're on an IIS web server, you need to edit the root WordPress installation's web.config file and surround it with the location element.

After doing that, my permalinks started working again just fine.  (Thank G-d...)

No comments:

Post a Comment