将每个查询重定向到上层文件夹中的文件

问题描述 投票:1回答:1

我在WebServer上具有此结构:

\main
   index.php

index.php文件可通过www.myurl.com/main/访问。

现在,我想将具有子文件夹结构(不存在的文件夹)的每个查询重定向到我的index.php文件,并传递输入的URL。

赞:

www.myurl.com/main/world/fish
www.myurl.com/main/hasuisdg
www.myurl.com/main/bowl/soup
www.myurl.com/main/salat

所有这些URL都应在传递URL时由我的index.php回答。

一般示例:

index.php的代码:

<?php

echo passedurl(); //this is the function i am looking for

?>

在浏览器中输入www.myurl.com/main/ilikestackoverflow。在网页上显示www.myurl.com/main/ilikestackoverflow

并非绝对重要:网址更改为www.myurl.com/main/

谢谢:)

php .htaccess redirect directory subdirectory
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.