This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Removing app.php from start of URL in Windows

Discuss installing Symfony 2 here

Removing app.php from start of URL in Windows

by deshg » Tue Jan 28, 2014 6:30 pm

I have a symfony2 project developed on a linux server and have migrated it (unfortunately!) to a windows server for reasons outside of my control. This all works as it should except for the url rewriting. I tried using the IIS URL Rewrite Module but it failed when converting most of the rules (and stupidly i didn't save a list of which ones it failed on).

It mostly works fine but the app.php is still present at the start of all urls which it shouldn't be. So the urls are when they should be

Unfortunately i rarely use windows servers and am not good at the web.config syntax so if anyone could suggest what is missing to remove the app.php from the start of all urls on the windows server then that would be greatly appreciated!

The original .htaccess file is:

Code: Select all
DirectoryIndex app.php

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]

RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]

RewriteRule .? %{ENV:BASE}/app.php [L]

<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
    RedirectMatch 302 ^/$ /app.php/

The converted web.config file is currently:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
            <rule name="Imported Rule 1" stopProcessing="true">
                <match url=".?" ignoreCase="false" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                <action type="None" />

Thanks very much!

Junior Member
Posts: 1
Joined: Tue Jan 28, 2014 6:25 pm