.htaccess mod_rewrite 麻烦
所以事情是这样的..我已经在我的网页上工作了一段时间了。我的根文件夹中有一个 .htaccess,其中仅包含几行重写规则,没有其他内容。它在本地主机上运行良好,但当我将其上传到我的主机时,它只会抛出 404 错误(我的主机是 000webhost.com)。我尝试一一消除每条规则以查看错误所在,但没有任何反应,我什至删除了 .htaccess 文件的内容,但仍然给出 404 错误。 (到目前为止)唯一有效的解决方案是删除 .htaccess 文件,然后才会出现主页。有什么建议吗?
So here's the thing .. I've been working on my webpage for some time now. I have a .htaccess in the root folder that contains only a few rows of rewriting rules and nothing else. It works fine on localhost but when I upload it to my host it just throws 404 error (my host is 000webhost.com). I tried eliminating every rule one by one to see where the error is, but nothing happened, I even deleted the contents of the .htaccess file and still it gives a 404 error. The only solution that worked (so far) was deleting the .htaccess file and only then the homepage appears. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚发现我的主机不支持 .htaccess 文件中的 UTF8 编码(我猜?),因此我将编码更改为 ANSI,结果成功了。
I just found out that my host doesn't support UTF8 encoding (i guess?) in .htaccess file so i changed the encoding to ANSI and it did the trick.
您是否尝试过网络托管服务商网站上的建议:
http://www.000webhost.com/faq.php?ID=16
他们建议您将其放在 .htaccess 的顶部
重写库 /
Have you tried the suggestion on your web host's site:
http://www.000webhost.com/faq.php?ID=16
they are suggesting you put this at the top of your .htaccess
RewriteBase /