一个网页有多个URL';s正在使用PHP


One web page with multiple URL's using PHP

我想知道如何让"website.com"有一个index.php文件,只需打开"website.com/home",但不更改URL。我最初使用它是为了在"website.com/index.PHP"内部使用"website/home/index.PHP"的PHP include,但当我不得不在"webwebsite.com/home/index.PHP"内部使用include时,它停止了工作,因为它从"website.microsoft.com/index.PHP"而不是"website.com/shome/indexphp"运行include"website.com/home/index.php"而不更改URL?我想避免使用绝对位置来简化它,这样我就可以将代码复制并粘贴到其他目录中,而不必相应地编辑它。

使用chdir()导航到正确的文件夹,然后使用include("index.php");