我正在关注laravel的快速启动,它说"type /users"
但不适合我.我在浏览器中写道,http://DomainServer/ProjectName/users
它抛出:
在此服务器上找不到请求的URL/ProjectName/users.Laravel
我试过以下,
启用apache模块mod_rewrite
也不起作用.
Linux环境中Apache Web Server和Laravel的步骤.
打开httpd.conf
sudo vim /etc/httpd/conf/httpd.conf # for debian users: /etc/apache2/apache2.conf
确保DocumentRoot指向laravel项目的公共目录
添加该路径的Directory元素和Allowoverride All ...,如下所示
DocumentRoot "/var/www/html/laravel/public/" <Directory "/var/www/html/laravel/public"> Allowoverride All </Directory>
从../laravel/public/打开.htaccess并确保它具有以下内容
<IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule>
重启httpd服务
sudo service httpd restart
现在http://DomainServer/users
可以在您的浏览器中使用.