【发布时间】:2016-06-02 03:41:03
【问题描述】:
我的公共目录中有一个不受 .htaccess 文件保护的资产文件夹。目前,我只是在资产文件夹中使用静态 index.html 页面,但我想要一种正确的重定向方式。我对 .htaccess 了解不多,因此我们将不胜感激。
我当前在公共目录中的 .htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
【问题讨论】:
-
如果您不想显示目录的内容,只需删除包含
!-d的倒数第三行。 -
@MikeRockett 非常感谢。现在可以了。我刚刚注册,所以我认为我还不能投票。再次感谢!
-
我会将我的评论添加为您可以接受的回答。
标签: php .htaccess laravel-5.2