【发布时间】:2017-12-12 15:07:53
【问题描述】:
我有 laravel 框架, 我试图隐藏 index.php,但是当我更改了我的 .htaccess 文件(在 Public_Html 下)时,它无法正常工作。 像-如果我用通用代码隐藏 index.php,那么除了 home 之外的所有 url 都不起作用。但是如果我在这种情况下使用 mydomain.com/index.php/contactus ,它就可以工作。 请检查代码和帮助
<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_URI} "/application/"
RewriteRule (.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
【问题讨论】:
-
查看link。它还可以帮助您解决与 apache 相关的设置。