我的FTP上有2个文件夹。
www /
www / test /
所以..
example.com
example.com/test
在文件夹中测试 htaccess是
RewriteRule booking\.php booking.php
但是当我点击链接
<a href"/booking">Link</a>
将我重定向到 https://example.com/booking
但是我需要重定向到 https://example.com/test/booking
能帮我吗?
我知道如何制作链接
<a href="/test/booking">
但是我需要使用htaccess做到这一点。
答案 0 :(得分:0)
使用使用^$
的重写规则,因为它表示根并将其重写到文件夹/ test中,如下所示:
使用此方法:
RewriteEngine On RewriteRule ^$ /test [L]
或此方法:
RewriteEngine on RewriteCond %{REQUEST_URI} !^/test RewriteRule ^(.*)$ /test/$1 [NC,L]