由於我是laravel的新手,我已經安裝了一個全新的副本,給予必要的權限並運行應用程序,一切都很好。 現在我有創建的Apache虛擬主機去除公衆,這也是工作的罰款:從Laravel 5中刪除public和index.php的最佳方法URLS
<VirtualHost *:80>
ServerName mobileapp
ServerAdmin [email protected]
DocumentRoot /var/www/html/mobileapp/public
<Directory "/var/www/html/mobileapp/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/mobileapp_error.log
CustomLog ${APACHE_LOG_DIR}/mobileapp_access.log combined
現在,該網站可以在本地通過http://mobileapp/index.php/pages訪問,但如果我從鏈接中刪除的index.php(不工作http://mobileapp/pages)。 我的.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] # <----- Tested not working
RewriteRule ^(.*)$ /$1 [L] # <----- neither this one
我也能mode_rewrite。任何人都可以告訴我什麼是最好的和簡單的方法來騎這個。
它在日誌文件中給出此錯誤:由於可能的配置錯誤,請求超出了10個內部重定向的限制 –
好的檢查更新的答案和更新你的問題,如果你更多的規則在你的htaccess – anubhava
是啊,它現在工作正常..謝謝。其實我已經將兩個.htaccess文件放在根目錄中,而另一個放在公共目錄中。現在我刪除根目錄(因爲DocumentRoot是公共目錄),然後將.htaccess更改爲舊目錄,工作正常......但是,您也可以在最壞的情況下工作,謝謝... :) –