我使用Mamp免费版。我想在当地工作。例如,make链接在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是一种让链接在本地工作的好方法吗?怎么做?
答案 0 :(得分:1)
使链接在htdocs / site1内部工作,因为它们位于根
中
您需要htdocs/.htaccess
中的这一单一规则(高于site1
的水平)
RewriteEngine On
RewriteRule ^((?!site1/).*)$ site1/$1 [NC,L]
您不需要.htaccess inside
site1 for this, you can remove that
RewriteBase`行。