首页 > 解决方案 > 使用路由器重定向登录

问题描述

登录后我无法重定向到我的主页

我的结构:

views/auth/login.php <-- Thats my Login Page
public/index.php/ <-- router
https://sub.mydomain.de/auth/login <-- login url
https://sub.mydomain.de/ <-- url after Login

如果登录有效,我想将用户重定向到此页面https://sub.mydomain.de/

我试过了:

header("/../../../public/index.php")

标签: php

解决方案


Location一切都很好,但这里缺少一件事header()

 `header("Location: /../../../public/index.php");`

您必须在标题中定义位置!

学习PHP一些令人兴奋的东西的最佳场所。

快乐编码!


推荐阅读