.htaccess yii2启用prettyurl导致内部服务器错误

.htaccess yii2启用prettyurl导致内部服务器错误,.htaccess,yii2,pretty-urls,.htaccess,Yii2,Pretty Urls,.htaccess 'components' => [ 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, ], /*other codes*/ 一切似乎都正常,运行init以确保设置可写入应用程序 但是仍然存在500个内部服务器错误请确保.htaccess与index.php位于同一文件夹中 这样地 ind

.htaccess

'components' => [
    'urlManager' =>
        [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        ],
/*other codes*/
一切似乎都正常,运行init以确保设置可写入应用程序
但是仍然存在500个内部服务器错误

请确保.htaccess与index.php位于同一文件夹中 这样地 index.php

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

检查服务器日志以查看问题所在。可能没有安装mod_rewrite。
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../../common/config/bootstrap.php');
require(__DIR__ . '/../config/bootstrap.php');

$config = yii\helpers\ArrayHelper::merge(
    require(__DIR__ . '/../../common/config/main.php'),
    require(__DIR__ . '/../../common/config/main-local.php'),
    require(__DIR__ . '/../config/main.php'),
    require(__DIR__ . '/../config/main-local.php')
);

$application = new yii\web\Application($config);
$application->run();