我在这里看到了一些解决办法,但他们没有帮助我。我的index.php在这里:http://localhost/basic-2/web/index.php。
我的目标是,如果我键入http://localhost/basic-2,浏览器会将我重定向到http://localhost/basic-2/web/index.php路径,但在浏览器中,URL是http://localhost/basic-2/index.php地址。因此,我想从web中删除(或隐藏)该子文件夹。
我在这里看到了很多解决方案..。但什么都没有)(现在,我有了这个:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/web/$1 -f [NC]
RewriteRule ^([^/]+)$ /web/$1 [P,L,QSA]但这只是列出文件夹和文件..。而不是重定向到子文件夹。
这可以重定向,但不会隐藏web文件夹。
RewriteEngine On
RewriteRule ^$ web [L]Edit1我发现了另一个规则:
RewriteEngine On
RewriteRule ^$ web/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ web/$1这可以重定向!但是这个规则仍然不能隐藏(或删除) web文件夹.
发布于 2013-10-02 22:50:06
试一试如下:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /basic-2/
RewriteCond %{DOCUMENT_ROOT}/basic-2/web/$1 -f [NC]
RewriteRule ^(.*)$ web/$1 [P,L,QSA]
RewriteCond %{THE_REQUEST} \ /basic-2/web/([^\?\ ]*)
RewriteRule ^ /basic-2/%1 [L,R=301]https://stackoverflow.com/questions/19147760
复制相似问题