laravel5.0在linux環境下解決.htaccess無效和去除index.php

確保如下配置項已正確配置:
LoadModule rewrite_module modules/mod_rewrite.so (去掉前面的#註釋)php

AllowOverride All (根目錄的配置下,確保設置成All)windows

框架安裝不用多說,你們自行解決咯。框架

其它版本不知道,博主是5.0的版本,因此直接找到根目錄下的public目錄,下面有個.htaccess文件,可是這個框架,在windows下安裝,上面兩項打開的話,是沒有任何問題的,能夠不帶index.PHP。ide

然而Linux須要加上一句話(」 RewriteBase / 「):code

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    ################################
    RewriteBase /
    ################################

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

而後訪問,OK!it

相關文章
相關標籤/搜索