locked
url rewrite for php RRS feed

  • Question

  • User493663129 posted

    hi everyone i used the following code in web.config to enable the web server to run php files without typing the extention:

    <rule name="rewritephp">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAll">
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="{R:1}.php" />
    </rule>

    but the problem is that now it doesnt let .chtml files to be opened without the extention. what should i do? pls help

    Friday, September 8, 2017 6:20 PM

All replies

  • User-460007017 posted

    Hi mdehghani,

    Why do you want to host the MVC application with PHP application? I think it is unavailable to apart the PHP friendly url out of MVC URL. So you could host the php in another website or a sub-webapplication. Like, you could create a virtual folder called phpapp. Then convert it to web application.So that you could add a condition pattern like:

      <add input="{URL}" pattern="^/phpapp/(.*)" />

    Best Regards,

    Yuk Ding

    Monday, September 11, 2017 6:32 AM