#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    2
    Rep Power
    0

    IIS not recognizing rewrite rules


    I have a symfony project running on IIS 7.5 (using URL Rewrite 2.0). I want to remove "index.php" from my URL's and I'm about to have a mental breakdown from trying for so long. I've tried different web.config files from the web that claim to do what I want, but I ALWAYS get a 404 error when I take out "index.php" from my URL. Here is what I'm trying at the moment:

    Code:
    <?xml version="1.0"?>
    <configuration>
        <system.webServer>
            <defaultDocument>
                <files>
                    <clear />
                    <add value="index.php" />
                </files>
            </defaultDocument>
    
            <rewrite>
                <rules>
                    <rule name="Silex Front Controller" stopProcessing="true">
                        <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        </conditions>
                    <action type="Rewrite" url="index.php" appendQueryString="true" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    Why not make index.php a default document rather than using rewrite?
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    2
    Rep Power
    0
    Originally Posted by Doug G
    Why not make index.php a default document rather than using rewrite?

    I need to have user-friendly URL's. If the URL is something like "example.com/video/example-video", I need it re-written to "example.com/index.php/video/example-video". If it doesn't get re-written, then IIS assumes that this is a directory and throws a 404 error, because there is no default document there.
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,453
    Rep Power
    4539
    Oh, sorry. I've never used IIS rewrite, sorry. The snip you posted doesn't look similar to Apache's mod_rewrite syntax so I don't even want to try to guess.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester

IMN logo majestic logo threadwatch logo seochat tools logo