【发布时间】:2016-09-02 12:53:17
【问题描述】:
我使用 Mamp 免费版。我想在当地工作。例如,使链接在 htdocs/site1 中工作,就像它们在根中一样。为了测试我尝试了这个:
在 htdocs 中,我有 2 个文件夹:site1 和 site2
在 site1 我有 2 个文件:file1.php 和 file2.php
在 site1 内,我有 .htaccess:
RewriteBase /site1/
在文件 1 中,我有一个链接可以检查是否可以使用绝对链接。它不起作用:
<a href="/file2.php" >go to file 2</a>
RewriteBase 是使链接在本地工作的好方法吗?该怎么做?
【问题讨论】:
-
你在哪里放置 .htaccess ?在site1目录?
-
是的,.htaccess 在 site1 内
-
所以你到底需要什么,按链接时这样说你期望site1/file2.php还是什么?
-
我尝试让链接在本地工作。因此,我在 file1.php 中放置了一个绝对链接,我希望它转到 file2.php。请记住 file2.php 在 htdocs/site1 中。
标签: php .htaccess mod-rewrite mamp