【发布时间】:2017-03-13 17:13:21
【问题描述】:
我尝试关注Yii2 Official Guide 为 enablePrettyUrl 选项配置 Apache-2.4x64。我的问题是尝试在浏览器中访问 localhost/about/web/ 时出现 500 服务器错误。我已将 .htaccess 放在我的 about/web 文件夹中。 这是它的配置:
# Set document root to be "basic/web"
DocumentRoot "d:/openserver/domains/localhost/about/web"
<Directory "d:/openserver/domains/localhost/about/web">
# use mod_rewrite for pretty URL support
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
# ...other settings...
</Directory>
可能到 about/web 的路径有问题?我只在我的 Windows 机器上出现此错误。
【问题讨论】:
-
Apache 日志中有什么内容?
-
path/to/localhost/about/web/.htaccess:此处不允许 DocumentRoot,引用者:dev/about
-
感谢您提醒我有关日志的信息。现在我明白了。
标签: php apache .htaccess server yii2