I’m playing with copying our existing EE installation from an older apache server to Windows Server 2012 and IIS 8. I have URL Rewrite enabled. Our EE installation has about 8 different sites so there are 8 different folders, each with their own index.php file, along with the main EE folder.
for example: /sites/EE /sites/site1 /sites/site2
I can’t get it to fully work. It will load each site’s main page (www.example.com/site1) but it won’t load any sub pages correctly. (www.example.com/site1/services/one) No matter what I change with regards to the rewrite it either loads the same thing as the main page or it gives ‘error 404’ for the sub pages.
I tried importing our existing .conf from apache and that doesn’t work either.
I’m wondering if it may have something to do with a server config or if the rewrite just isn’t correct. I’ve tried various tweaks (adding a question mark after index.php, enabling “Append query string”, etc.) Perhaps there a a couple things I have set wrong and I need to find the right combination.
I’d appreciate it if someone could recommend some things to check or test to help narrow down the cause.
Thanks!
I finally got it to work. It took a ton of trial and error, reading various postings from all over the web, and more or less finding the right combination of things. I’d think that it shouldn’t be this challenging and others have probably got it working. It should be better documented and supported, in my opinion. I hope it helps someone else.
Note that we have EE installed in a subfolder and a bunch of MSM sites. The goal was to remove index.php. It’s installed on Windows 2012 r2 with IIS 8.
/web data/ABC (contains EE)
/web data/dept1 (MSM site)
/web data/dept2 (MSM site)
/web data/dept3 (MSM site)
edit EE system config.php: $config[‘uri_protocol’] = ‘QUERY_STRING’;
Expression Engine control panel: Force URL query strings = Off
ABC rewrite:
<rule name="ABC EE MSM depts" enabled="true" stopProcessing="true">
<match url="^(dept1|dept2|dept3)/?(.*)$" ignoreCase="true" >
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{URL}" pattern="(css|scripts|images|js|inc)" negate="true" >
</conditions>
<action type="Rewrite" url="{R:1}/index.php?/{R:1}/{R:2}" appendQueryString="false" >
</rule>
<rule name="ABC EE" enabled="true" stopProcessing="true">
<match url="^(.*)$" ignoreCase="true" >
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{URL}" pattern="^(/ABC/ABC_system|/ABC/themes|/ABC/admin.php)" negate="true" >
<add input="{URL}" pattern="(css|scripts|images|js|inc)" negate="true" >
</conditions>
<action type="Rewrite" url="ABC/index.php?/{R:1}" appendQueryString="false" >
</rule>If anyone has any tips for improving it then those would be appreciated. Thanks!
edit: as a test I removed the {URL} exceptions listed above and replaced them with two simple ones for ‘ignore if folder’ and ‘ignore if file’ and that worked as well.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.