1
使用Laravel 5.5,試圖訪問http://127.0.0.1:8000/test/search/357我得到一個頁面無法找到錯誤。非其他解決方案已爲我工作。我的.htaccess文件駐留在根目錄下,看起來像這樣:mod_rewrite不能在Laravel 5
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
Options +FollowSymLinks
RewriteEngine On
RewriteBase "/test/"
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/test/ # <=== NEW LINE!!!!
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
RewriteRule ^/test/search/(.*)$ /test/search?m_id=$1&a=1 [QSA, L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
任何幫助,將不勝感激。謝謝。
你有語法錯誤。您打開IfModule兩次,但只關閉一次。除此之外,我認爲在laravel中使用htaccess重定向而不是路由並正確設置虛擬主機並不是一個好主意。 – ElChupacabra