Pergunta

How to enable url friendly in yii in AWS? I have an error, an internal error server! in my server of AWS ec2. I use yii framework. In my app of yii I have and .htaccess with this content:

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

then i active mod_rewrite with:

   #a2enmod rewrite

Then I edit /etc/apache2/sites-available/defalut and i configure AllowOverride All in <Directory /var/www/> Then i edit: /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>/$
                        ),
                ),

finally restart Apache with:

sudo service apache2 restart

Where is my error??

In my apache error log file i have this error:

[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

and my Index of / i can't see my app folder, I suposed that i can't access because i don't have permissions!

Thanks guys!!!

Foi útil?

Solução

I think you are missing a space between {REQUEST_FILENAME} and the arguments like so:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top