Web.config WordPress rewrite rules next to Magento
Posted
by
Flo
on Pro Webmasters
See other posts from Pro Webmasters
or by Flo
Published on 2013-10-03T19:41:14Z
Indexed on
2013/11/05
22:13 UTC
Read the original article
Hit count: 561
I've installed Magento on IIS in folder: E:\mydomain\wwwroot
(I already have it all running correctly).
I have no deeper folder magento
, I placed all files directly in the wwwroot
folder, so:
wwwroot\app
wwwroot\downloader
wwwroot\errors
wwwroot\includes
etc...
UPDATE: since I'm on IIS my .htaccess
is ignored completely and my web.config
rules are used instead. Here's my web.config in folder e:\mydomain\wwwroot
:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Magento SEO: remove index.php from URL">
<match url="^(?!index.php)([^?#]*)(\\?([^#]*))?(#(.*))?" />
<conditions>
<add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Next, I wanted to install WordPress.
I unzipped all files in folder e:\mydomain\wwwroot\wordpress
Browsed to www.mydomain.com/wordpress/wp-admin/install.php, where I configured everything for my database. Everything was installed correctly.
I then navigate to http://www.mydomain.com/wordpress/wp-login.php where I type my credentials. I seem to be logged in and am redirected to http://www.mydomain.com/wordpress/wp-admin/ But there I receive an empty page. I enabled detailed error message in IIS following this article: http://www.iis.net/learn/troubleshoot/diagnosing-http-errors/how-to-use-http-detailed-errors-in-iis I also checkec with Fiddler and see that I receive a 500 error:
GET /wordpress/wp-admin/ HTTP/1.1 Host: www.mydomain.com Connection: keep-alive Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36 Referer: http://www.mydomain.com/wordpress/wp-login.php Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8,nl;q=0.6 Cookie: wordpress_fabec4083cf12d8de89c98e8aef4b7e3=floran%7C1381236774%7C2d8edb4fc6618f290fadb49b035cad31; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_fabec4083cf12d8de89c98e8aef4b7e3=floran%7C1381236774%7Cbf822163926b8b8df16d0f1fefb6e02e
HTTP/1.1 500 Internal Server Error Content-Type: text/html Server: Microsoft-IIS/7.5 X-Powered-By: PHP/5.4.14 X-Powered-By: ASP.NET Date: Sun, 06 Oct 2013 12:56:03 GMT Content-Length: 0
My WordPress web.config in folder e:\mydomain\wwwroot\wordpress
contains:
<?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></rules>
</rewrite>
</system.webServer>
</configuration>
I also want my WordPress articles to be available on www.mydomain.com/blog
instead of www.mydomain.com/wordpress
Ofcourse my admin links for Magento and Wordpress should also work.
How can I configure my web.config files to achieve the above?
© Pro Webmasters or respective owner