2

こんにちは、wamp で Alto Router というパッケージを使用したいと考えています。

wwwルートで、インデックスページを変更しました

<?php
    require( __DIR__ . "/vendor/autoload.php");



    $router = new AltoRouter();

    $router->map('GET','/',function(){
    include(__DIR__ . "/project/home.php");


    });

    $router->map('GET','/page1',function(){
    include(__DIR__ . "/project/page1.php");

    });

    $match = $router->match();

    if($match && is_callable($match['target'])){
    call_user_func_array($match['target'],$match['params']);

    }
    else{
    //no route found
    header($_SERVER['SERVER_PROTOCOL'].'404 Not Found');

    }

ホームページのリダイレクトは問題ありませんが、localhost/page1 と入力すると、404 エラー ページにリダイレクトされます。これは、デフォルトの wamp サーバー設定などが原因だと思います。変更する必要はありますか?

4

1 に答える 1