I'm trying to follow the slim slim tutorial, but it always gives page not found when access localhost: 8080 / hello / alan.
I'm using iis 10. I installed url rewrite 2.0, and my web.config looks like this:
<?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>
The directory structure of my application is:
.
├──project
│ └── src
│ └── public
The root of the site is the public folder and the index.php file and web.config are located in it.
The index.php code is:
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '../vendor/autoload.php';
$app = new \Slim\App;
$app->get('hello/{name}', function(Request $request, Response $response, array $args){
$name = $args['name'];
$response->getBody()->write("Hello, $name");
return $response;
});
$app->run();
I looked for help on the internet and could not get a response.