I am using CakePHP3 on IIS server first time .
I have translate the .htaccess file into webconfig and put it on the root of my project directory.
After that I am able to access my home page.
Home page :- controller :- Home and action :- index in route.php :-
$routes->connect('/', ['controller' => 'Home', 'action' => 'index', 'index']);
But issue is coming when I try to access the action of other controller example(/cakephp/dashboard/profile)
:-
When I try to access profile action of Dashboard controller then it gives me 404 not found error . The same code is working correctly on Linux using .htaccess.
When I add index.php manually after controller(/cakephp/index.php/dashboard/profile)
then it is working fine.
Anyone help me how can I fix this issue ?
Here is project directory:- /httpdocs/cakephp/ Under this i have created a web.config file as:-
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear/>
<rule name="Exclude direct access to webroot/*" stopProcessing="true">
<match url="^webroot/(.*)$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="Rewrite routed access to assets(img, css, files, js, favicon)" stopProcessing="true">
<match url="^(img|css|files|js|favicon.ico)(.*)$" />
<action type="Rewrite" url="webroot/{R:1}{R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="webroot/" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<action type="Rewrite" url="webroot/{R:1}" />
</rule>
<rule name="Imported Rule 3" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>