yii2前端和后端不在共享服务器上工作

时间:2014-12-18 04:51:01

标签: php shared-hosting yii2

我们在yii2中构建了一个项目。它在本地服务器上正常工作。但它不适用于共享服务器。我在htaccess尝试了很多,但仍然没有为我工作。它给了我500内部服务器错误

前端htaccess:

RewriteEngine on

# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php

后端htaccess

RewriteEngine on

# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

可能服务器不支持16位.php文件。 当您将文件另存为UTF-8时,某些编辑器(例如Windows上的记事本)将始终添加字节顺序标记(BOM),因此请确保使用文本编辑器保存没有BOM的文件。 我有完全相同的问题,我花了很长时间来调试问题,因为两种格式的文本在查看时看起来都相同。 使用session_start()时问题非常明显,因为文件必须以