【发布时间】:2014-05-15 10:25:35
【问题描述】:
如何在 AWS 的 yii 中启用 url 友好? 我有一个错误,一个内部错误服务器!在我的 AWS ec2 服务器中。 我使用 yii 框架。 在我的 yii 应用中,我拥有和 .htaccess 的内容:
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:
#a2enmod rewrite
然后我编辑 /etc/apache2/sites-available/defalut 并配置 AllowOverride All
在
<Directory /var/www/>
然后我编辑:
/var/www/myapp/protected/config/main.php
// uncomment the following to enable URLs in path-format
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
#'urlSuffix'=>'.asp',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view$
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<con$
'<controller:\w+>/<action:\w+>'=>'<controller>/$
),
),
最后重启 Apache:
sudo service apache2 restart
我的错误在哪里??
在我的 apache 错误日志文件中我有这个错误:
[Thu May 15 09:53:16 2014] [alert] /var/www/joc/.htaccess:RewriteCond: **bad argument line '%{REQUEST_FILENAME}!-f'
[Thu May 15 10:10:15 2014] [error] client denied by server configuration: /var/www/yii/framework/views/ar/log.php
我的索引/我看不到我的应用程序文件夹,我认为我无法访问,因为我没有权限!
谢谢大家!!!
【问题讨论】:
标签: apache .htaccess url mod-rewrite yii