The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

IIS rewrite rule

Sjef's Avatar

Sjef

24 Sep, 2014 12:37 PM

Hi,
Being new to Slim i used the rewrite rules as suggested by Colling Williamson. In general they work very well for me, but if I add a query string to the url things get nasty

my get request is via '/assignments/:id'
url: assignments/37?uid=4

And than the query part ends up in the route ('37?uid=4')

Any suggetions on how to solve?

  1. 1 Posted by Sjef on 24 Sep, 2014 12:57 PM

    Sjef's Avatar

    This is the rewrite rule I'm using:

    <rewrite> <rules> <rule name="Cols Rule" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions> <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="index.php?q={R:1}" appendQueryString="true" /> </rule> </rules> </rewrite>

  2. 2 Posted by Sjef on 24 Sep, 2014 05:54 PM

    Sjef's Avatar

    Fixed this issue using the rewrite rules on https://github.com/codeguy/Slim

    <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="slim" 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>

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac