我正在关注laravel的快速入门,它说"type /users",但对我不起作用. 我已经在浏览器中写了DomainServer/ProjectName/users并抛出:
I am following the quickstart of laravel and it said "type /users" but not working for me. I have wrote in the browser, DomainServer/ProjectName/users and it throws:
在此服务器上找不到请求的URL/ProjectName/users. Laravel
The requested URL /ProjectName/users was not found on this server. Laravel
我尝试了以下方法,
要启用apache模块mod_rewrite,它也不起作用.
To enable the apache module mod_rewrite and also does not work.
推荐答案Linux环境中Apache Web Server和Laravel的步骤.
Steps for Apache Web Server and Laravel in Linux Environment.
打开httpd.conf
Open httpd.conf sudo vim /etc/httpd/conf/httpd.conf # for debian users: /etc/apache2/apache2.conf
确保DocumentRoot指向laravel项目的公共目录
Make sure the DocumentRoot is pointing to the laravel project's public directory
为该路径添加Directory元素,并全部允许Allowoverride ...,如下所示
Add the Directory element for that path and Allowoverride All... as follows
DocumentRoot "/var/www/html/laravel/public/" <Directory "/var/www/html/laravel/public"> Allowoverride All </Directory>
从../laravel/public/中打开.htaccess,并确保它具有以下内容
Open .htaccess from ../laravel/public/ and make sure it has the following
<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服务
Restart httpd services
sudo service httpd restart
现在DomainServer/users将在您的浏览器中运行.
Now DomainServer/users will work in your browser.
更多推荐
在此服务器上找不到请求的URL/ProjectName/users.拉拉韦尔
发布评论