

HTMLメール本文のリンクからログインフォームにリダイレクトさせたいのですが、うまく行かず詰まっています。どなたかアドバイスを頂けないでしょうか。

**エラーメッセージ**

[code]

    404/The requested URL /kento/register/login.php was not found on this server.
    
[/code]

**ソースコード**

[code]

    <?php
    
    if(isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') {
        ini_set('display_errors',1);//画面にエラーを表示
        error_reporting(E_ALL);
        session_start();
    
        $firstname='';
        $lastname='';
        $email='';
        $phone='';
        $birthdate='';
        $username='';
        $password='';
    
        if(isset($_POST['firstname']) && isset($_POST['lastname']) && isset($_post['email'])
                && isset($_POST['phone']) && isset($_POST['birthdate']) && isset($_POST['username'])
                && isset($_POST['password'])){
            $_SESSION["USER"] = 'USER';
            header("Location:https:/Applications/MAMP/htdocs/kento/php/microblog/login.php");
            exit;
        }
    
        if(isset($_POST['email'])){
            echo "Please check the Email";
        } else {
            echo "Your Email is invalid , please check your Email address again";
        }
    
        $dsn ='mysql:host=localhost;dbname=microblog';
        $user ='root';
        $password ='root';
        //$USER = $FILES['firstname']['lastname']['email']['phone']['birthdate']['username']['password'];
        try {
            $db = new PDO($dsn,$user,$password);
            $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $stmt = $db->prepare("INSERT INTO users(firstname,lastname,email,phone,username,password)
                    VALUES (:firstname, :lastname, :email, :phone, :username, :password)");
            $stmt->execute(array(
                        ':firstname' => $_POST['firstname'],
                        ':lastname'  => $_POST['lastname'],
                        ':email'     => $_POST['email'],
                        ':phone'     => $_POST['phone'],
                        ':username'  => $_POST['username'],
                        ':password'  => $_POST['password']
                        ));
    
        } catch(PDOException $e){
            die ('error:'.$e->getMessage());
        }
    
        $to = $_POST['email'];
        $subject = 'Email vertification';
        $message = '
            <html>
            <head>
            <title>sending link</title>
            </head>
            <body>
            <a href="https://localhost:8080/MAMP/htdocs/kento/register/login.php">Click this link to activate your account!</a>
            </body>
            </html>
            ';
        $headers = 'MIME-Version: 1.0';
        $headers = 'Content-type: text/html; charset=iso-8859-1';
    
        mail($to,$subject,$message,$headers);
    }
    
    ?>
    <!DOCTYPE html>
    <html>
    <head></head>
    <body>
    
    <h2>Register your information</h2>
    
    <form method="POST" action="register.php">
    Fastname:<input type="text" name="firstname"><br><br>
    Lastname:<input type="text" name="lastname"><br><br>
    Email Adrress:<input type="text" name="email"><br><br>
    Phone Number:<input type="text" name="phone"><br><br>
    Birth Date:<input type="text" name="birthdate"><br><br>
    Username:<input type="text" name="username"><br><br>
    Password:<input type="text" name="password"><br><br>
    <input type="submit" name="register" value="Register">
    </form>
    
    </body>
    </html>
    
[/code]


CC BY-SA 4.0
2019-05-26T05:04:56.953
55254
2019-06-05T05:15:17.613
2019-06-05T05:15:17.613
3060
34463
question
php
リダイレクトがうまくいきません。


routesファイルでルート設定をしてあげる事で自己解決いたしました。

[code]

        Router::connect('/', array('controller' => 'Pages', 'action' => 'home'));
    Router::connect('/signup', array('controller' => 'Users', 'action' => 'signup'));
    Router::connect('/login', array('controller' => 'Users', 'action' => 'login'));
    Router::connect('/profile', array('controller' => 'Users', 'action' => 'profile'));
    Router::connect('/search', array('controller' => 'Follows', 'action' => 'search'));
    Router::connect('/logout', array('controller' => 'Users', 'action' => 'logout'));
    
[/code]


CC BY-SA 4.0
2019-06-05T04:37:05.997
55541
2019-06-05T04:37:05.997
34463
55254
answer