本地 Laravel 项目无法加载,是否是 htaccess 的配置问题?
环境 MAMP 5.0.1 / MAC OS
情况是这样的:从服务器上把laravel 项目复制到本地后,无法加载任何页面
-
正常加载 .htaccess 后,提示如下
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@dummy-host2.example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.
-
如果不加载htaccess,提示
Not Found
The requested URL /public was not found on this server.
htaccess 里的内容:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteRule ^$ http://www.code111.com/cn/ch.html [R=301,L]
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|\.ico|\.svg|\.woff|\.otf|\.ttf|\.pdf|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(css|fonts|i|js|pdf|uploads|lib)/(.*)$ public/$1/$2 [L,NC]
RewriteEngine On
</IfModule>
推荐文章: