daveh / php-mvc

A simple PHP model-view-controller framework, built step-by-step as part of the "Write PHP like a pro: build an MVC framework from scratch" course on Udemy.
https://davehollingworth.com/go/phpmvc/
MIT License
782 stars 311 forks source link

ajax request 404 not found #91

Closed roobiniano closed 3 years ago

roobiniano commented 3 years ago

Hi Dave, how are you? Here again with questions.

I am running the application on a windows server. The root of the server is pointed to the public folder of the project. The rewrite rule go to index.php, but QUERY_STRING is always empty.

thats my rewrite in IIS, i cant get de routes in QUERY_STRING

<?xml version="1.0"?>
<configuration>
  <system.webServer>
    <defaultDocument>
      <files>
        <clear />
        <add value="index.php" />
      </files>
    </defaultDocument>
    <rewrite>
      <rules>
        <rule name="Imported Rule 2" stopProcessing="true">
          <match url="^(.*)$" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Thanks again dave

roobiniano commented 3 years ago

Solve, just a litlle modification ja <action type="Rewrite" url="index.php?{R:1}" appendQueryString="true" />