Hi, I'm trying to get the mod rewrite rules converted for IIS. I used IIS's import rules tool and chose the htaccess htaccess_dist file (I assumed that was the right one). After applying that, I got a 500 rules where it said:
HTTP Error 500.52 - URL Rewrite Module Error.
The expression "^pg\/([A-Za-z0-9\_\-]+)$" contains an unmatched '[' or ']'.
After digging around, I realized that it was because it wasn't supposed to escape the undscore on windows, so I changed it to say:
^pg\/([A-Za-z0-9_\-]+)$
This got rid of the 500 error, but despite the file being in my web.config, it still has this message in the install process:
We think your server is running the IIS web server.
The rewrite rules test failed. You need to configure your web server with Elgg's rewrite rules and try again.
I have no idea why the rewrite rules have failed at this point and there's no other information that it gives me. Here's the entirety of my web.config file:
<?xml version="1.0" encoding="UTF-8"?><configuration><system.webServer><rewrite><rules><rule name="Imported Rule 14" stopProcessing="true"><match url="^pg\/([A-Za-z0-9_\-]+)$" ignoreCase="false" /><action type="Rewrite" url="engine/handlers/page_handler.php?handler={R:1}&{QUERY_STRING}" appendQueryString="false" /></rule><rule name="Imported Rule 15" stopProcessing="true"><match url="^pg\/([A-Za-z0-9_\-]+)\/(.*)$" ignoreCase="false" /><action type="Rewrite" url="engine/handlers/page_handler.php?handler={R:1}&page={R:2}&{QUERY_STRING}" appendQueryString="false" /></rule><rule name="Imported Rule 16" stopProcessing="true"><match url="^tag\/(.+)\/?$" ignoreCase="false" /><action type="Rewrite" url="engine/handlers/page_handler.php?handler=search&page={R:1}" appendQueryString="false" /></rule><rule name="Imported Rule 17" stopProcessing="true"><match url="^action\/([A-Za-z0-9_\-\/]+)$" ignoreCase="false" /><action type="Rewrite" url="engine/handlers/action_handler.php?action={R:1}&{QUERY_STRING}" appendQueryString="false" /></rule><rule name="Imported Rule 18" stopProcessing="true"><match url="^cache\/(.*)$" ignoreCase="false" /><action type="Rewrite" url="engine/handlers/cache_handler.php?request={R:1}&{QUERY_STRING}" appendQueryString="false" /></rule><rule name="Imported Rule 19" stopProcessing="true"><match url="^services\/api\/([A-Za-z0-9_\-]+)\/(.*)$" ignoreCase="false" /><action type="Rewrite" url="engine/handlers/service_handler.php?handler={R:1}&request={R:2}&{QUERY_STRING}" appendQueryString="false" /></rule><rule name="Imported Rule 20" stopProcessing="true"><match url="^export\/([A-Za-z]+)\/([0-9]+)\/?$" ignoreCase="false" /><action type="Rewrite" url="engine/handlers/export_handler.php?view={R:1}&guid={R:2}" appendQueryString="false" /></rule><rule name="Imported Rule 21" stopProcessing="true"><match url="^export\/([A-Za-z]+)\/([0-9]+)\/([A-Za-z]+)\/([A-Za-z0-9_]+)\/$" ignoreCase="false" /><action type="Rewrite" url="engine/handlers/export_handler.php?view={R:1}&guid={R:2}&type={R:3}&idname={R:4}" appendQueryString="false" /></rule><rule name="Imported Rule 22" stopProcessing="true"><match url="xml-rpc.php" ignoreCase="false" /><action type="Rewrite" url="engine/handlers/xml-rpc_handler.php" /></rule><rule name="Imported Rule 23" stopProcessing="true"><match url="mt/mt-xmlrpc.cgi" ignoreCase="false" /><action type="Rewrite" url="engine/handlers/xml-rpc_handler.php" /></rule><rule name="Imported Rule 24" stopProcessing="true"><match url="^rewrite.php$" ignoreCase="false" /><action type="Rewrite" url="install.php" /></rule><rule name="Imported Rule 25" stopProcessing="true"><match url="^([A-Za-z0-9_\-]+)$" ignoreCase="false" /><conditions logicalGrouping="MatchAll"><add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /></conditions><action type="Rewrite" url="engine/handlers/page_handler.php?handler={R:1}" appendQueryString="true" /></rule><rule name="Imported Rule 26" stopProcessing="true"><match url="^([A-Za-z0-9_\-]+)\/(.*)$" ignoreCase="false" /><conditions logicalGrouping="MatchAll"><add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /></conditions><action type="Rewrite" url="engine/handlers/page_handler.php?handler={R:1}&page={R:2}" appendQueryString="true" /></rule></rules></rewrite></system.webServer></configuration>
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
Hi,
Yes, I'm getting this error too, did you find a fix?
Mat
For now, I've installed 1.7.3 and used this guide docs.elgg.org/wiki/Elgg_and_IIS as that appears to be the only guide on getting this working in IIS.
Importing the rules should work using IIS 7.5. Put the elgg directory into the root wwwroot and try again, then work from there. It may be failing with the relative paths in the rules.
Is there someone who installed Elgg 1.8 under an IIS server?
Yes I did the other day.
I found you can import the rules, but you have to do the following - search for any \_ inthe imported rules sheet and take out the \ .
That should get it working for you
Mat
By the way, when I said import the rules, I meant the rules that come with the Elgg 1.8 release. Import those, edit your newly created web.access file (as that is what IIS uses instead htaccess) on something like notepad, search for the term \_ and replace it with _ there should be i think 5 of them.
That should get you going.
Mat
@AmmyKami83
I will try this tomorrow. Do you have an example file?
@AmmyKami83 can you post the converted and fixed rules here or submit them in a ticked so we could put them with the documentation?
Hi,
Yes sure, this is what worked for me:
@AmmyKami83
Did you use this for import the rewrite rules:
http://www.iis.net/downloads/microsoft/url-rewrite
I am asking because I'm working next month on articles about elgg 1.8 running under IIS servers, since there has been several requests about it.
Thanks!
Rodolfo Hernandez
Arvixe/Elgg Community Liaison
- Previous
- 1
- 2
- Next
You must log in to post replies.