【问题标题】:enable URL friendly in YII in AWS在 AWS 的 YII 中启用 URL 友好
【发布时间】: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


    【解决方案1】:

    我认为您在 {REQUEST_FILENAME} 和参数之间缺少一个空格,如下所示:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-08
      • 2012-07-22
      • 1970-01-01
      相关资源
      最近更新 更多