Url Configuration And Htaccess With Yii

I have set up my yii application with the following configuration :













My mod_rewrite is enabled . I have confirmed the same through multiple ways .

My htacccess reads :

RewriteEngine on

                   # if a directory or a file exists, use it directly

                   RewriteCond %{REQUEST_FILENAME} !-f

                   RewriteCond %{REQUEST_FILENAME} !-d

                   RewriteRule ^.*$ /index.php?

I have come across multiple similar posts on the forums , tried everything suggested in them but it does not work out .

I can access the index page (home page) , however every other link is being looked at like a directory(giving a 404) instead of controller/action pair . httpd.conf has re write enabled . I looked at apache error logs and found the following :

[error] [client] File does not exist: /home/curatio/public_html/curatio/site, referer:

[Wed Jan 16 08:42:20 2013] [error] [client] File does not exist: /home/curatio/public_html/curatio/site, referer:

/home/curatio/public_html/curatio/ is where my website files are , however it is looking for a site folder .

Any ideas ? I would be happy to provide more details as well .

Note : It works fine with ?r (/ works just fine .

I have removed the http above to not embed a link .

Hi and welcome to the Yii forum…

You added there two strange rules, try to remove the first two rules (’/’=>’’ and ‘site’=>’’)

Thanks for reply . The two rules ensure that when no controller is mentioned in the url , user lands on home page and works fine on local. I changed the rules to standard types on the deployment server but to no avail . I additionally added a echo followed by an exit statement in the index.php . It was followed when I used no controller action pair(indicating it picked up index.php by default) , however when I entered a controller action pair it threw a 404 . This indicates that there is something definitely wrong with my htaccess file , doesnt it ?

Would sharing virtual hosts and directory configuration from httpd be of any help ?

Deny from all works fine in the htaccess file for the app directory . However I observed the following :

  1. Removing everything from htaccess still lands the index page . (probably default behaviour to look for index.php)

  2. I changed the name of index file so that there was no file named index in the application root directory : it threw a 403 .

  3. For any other controller action pair it seems to look for folders under apache http folder . I am not sure why this is happening .

Try to change the last htaccess line to

RewriteRule . index.php

or if it does not work to

RewriteRule ^.*$ index.php