3
大家好,我正在爲Laravel 5.2中的項目工作。我已經在我的本地機器上設置了我的項目,但它現在工作時沒有在url中添加index.php。laravel 5.2項目沒有在url上添加index.php沒有運行
我隨URL請求: -
http://localhost/project_folder/admin
雖然我想沒有的index.php就跑我的網址它給了我下面的錯誤。
Not Found
The requested URL /project_folder/admin was not found on this server.
爲此,我做了以下步驟:1 )提供許可(777)存儲和緩存文件夾。 2)我去路徑/etc/apache2/sites-available/000-default.conf並編輯它,現在它看起來像這樣。
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin [email protected]
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
在我的.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]
RewriteRule ^(.*)/$ /moduleTesting/$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
如果我忘記了任何需求或其他事情,請給我建議。
沒有'的DirectoryIndex index.php文件'在你的apache配置中。 Apache不知道當沒有URL提供的文件時它應該打開的默認文件是什麼 –
[如何爲Apache 2.2啓用mod \ _rewrite]可能的重複(http://stackoverflow.com/questions/869092/how-to-enable-mod-rewrite-for-apache-2-2) – Matheno
你是否開始Apache服務。 –