Hello, thanks for answering, I tried with this configuration and it does not work!.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="slim" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I tried with this configuration and the Hello world example works!
my project is {project-root}/public/index.php and I set
$app->setBasePath(“/public”);
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Exclude direct access to webroot/*"
stopProcessing="true">
<match url="^public/(.*)$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="Rewrite requested file/folder to index.php"
stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<action type="Rewrite" url="index.php"
appendQueryString="true" />
</rule>
<rule name="slim catch all" enabled="true">
<match url="^public/(.*)$" />
<action type="Rewrite" url="/index.php" />
<conditions>
<add input="{URL}" pattern="/public/.*" negate="true" />
</conditions>
</rule>
</rules>
</rewrite>
<defaultDocument>
<files>
<add value="index.php" />
</files>
</defaultDocument>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
but the example “hello/1234” does not work, it gives me the error 404 not found
my routes are:
$app->get('/', function (Request $request, Response $response) {
$response->getBody()->write('Hello, World!');
return $response;
})->setName('root');
$app->get('/hello/{name}', function (Request $request, Response $response, array $args) {
$name = $args['name'];
$response->getBody()->write("Hello, $name");
return $response;
});
Thanks for the help!