【发布时间】:2015-02-08 17:37:51
【问题描述】:
我有这样的 laravel 文件夹
- 应用程序
- 供应商
- 引导
- 公开
- 文件夹
- img
当我从 url 访问时 http://example.com/img/img.png 有效 但是当我像http://example.com/img/ 这样访问时,我得到了 Forbidden 403, 我需要的是重定向或显示该页面未找到 我的 .htaccess 看起来像这样。
选项 - 多视图 选项 - 索引 重写引擎开启
RewriteCond %{HTTP_HOST} ^1\.1\.1\.1 RewriteRule (.*) https://www.example.com/$1 [L,R=301] RewriteCond %{HTTPS} off # First rewrite to HTTPS: RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Now, rewrite any request to the wrong domain to use www. RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [L] </IfModule>
【问题讨论】:
标签: php .htaccess mod-rewrite laravel