Laravel默认.htaccess文件将不起作用 [英] Laravel default .htaccess file will not work

查看:728
本文介绍了Laravel默认.htaccess文件将不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我终于为Laravel安装了所有程序,但是我的主页上出现了错误500!

I finally got everything installed for Laravel, but I am getting an error 500 on my home page!

它似乎是我的.htaccess文件。如果我将其删除,则该页面有效。如果我放回去,另一个错误500。

It looks to be my .htaccess file. If I remove it the page works. If I put it back, another error 500.

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

如果我将倒数第二行更改为 RewriteRule ^ index.php [L](否index.php之前的空格),错误500消失了,但是重写规则不起作用。

If I change that second to last line to "RewriteRule ^index.php [L]" (no space before index.php) then the error 500 goes away but the rewrite rule will not work.

我的主机是1and1.com。

My host is 1and1.com.

有人可以帮助我吗?

推荐答案

更改此行:

    RewriteRule ^ index.php [L]

为此:

    RewriteRule ^ /index.php [L]

现在可以使用了。我不仅没有收到500错误,而且这些URL似乎可以正常工作。

Now it works. Not only do I not get the 500 error, but the URLs appear to work as intended.

这篇关于Laravel默认.htaccess文件将不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆