我正在关注laravel的快速入门,"type /users"
但它对我来说不起作用。我在浏览器中写过,http://DomainServer/ProjectName/users
它抛出:
在此服务器上找不到请求的URL / ProjectName / users。拉拉韦尔
我尝试了以下方法
要启用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
可以在您的浏览器中使用了。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句