我正在尝试重写这样的文件夹中的所有请求:
http://www.test.com/banana/banana (或其他)转到 http://www.test.com/public ,但网址仍为 http://www.test.com/banana/banana
我该怎么做?
厂家批号
答案 0 :(得分:2)
在特定文件夹内,您可以使用此规则创建.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /public/ [L]
答案 1 :(得分:1)
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /public/index.php [NC,L,QSA]
此.htaccess
会将所有请求重写为/public/index.php
。仍将提供现有文件和目录。