如何将php文件重定向到文件夹位置之外?

时间:2017-03-13 06:47:36

标签: php html .htaccess redirect

您好,如何将页面重定向到'模型'文件夹,因为我的所有html文件都在它之外。我想使用此位置重定向我的页面

http://localhost/laurence/FirstDayTraining/index.html

实施例: 我在'模型'里面有一个php文件夹。文件夹名称login.php所以为了将其重定向到index.html,我必须使用header("Location: laurence/firstdaytraining/index.html");但是当我点击输入时会显示

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

并且该位置将转到此路径

http://localhost/laurence/FirstDayTraining/Model/index.html

请帮助,如何在此

中重定向我的页面
http://localhost/laurence/FirstDayTraining/index.html

但不是这个

http://localhost/laurence/FirstDayTraining/Model/index.html

3 个答案:

答案 0 :(得分:2)

根据您的信息,尝试以下内容:

header("Location: ../index.html");

答案 1 :(得分:1)

〜/ webpath /劳伦斯/ FirstDayTraining / index.html中

试试这个?并将webpath更改为您的网站文件夹。 〜/表示你的用户文件夹,如果你在Linux上。

答案 2 :(得分:1)

这将100%肯定会帮助你!

sudo ./studio.sh

希望你接受这个: - )