Yii Framework Forum: Url Configuration And Htaccess With Yii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Url Configuration And Htaccess With Yii Rate Topic: -----

#1 User is offline   Mangoperson 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 16-January 13

Posted 16 January 2013 - 09:34 AM

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

 'urlManager'=>array(
			'urlFormat'=>'path',
			'showScriptName'=>false,
			'rules'=>array(
			
			
			
			'/'=>'',
			'site'=>'',
			'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			'<controller:\w+>'=>'<controller>',
                    )


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 182.68.214.169] File does not exist: /home/curatio/public_html/curatio/site, referer: 216.224.170.30/~curatio/curatio/
[Wed Jan 16 08:42:20 2013] [error] [client 182.68.214.169] File does not exist: /home/curatio/public_html/curatio/site, referer: 216.224.170.30/~curatio/curatio/site/contact


/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 (/216.224.170.30/~curatio/curatio/?r=site/contact) works just fine .
I have removed the http above to not embed a link .
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,317
  • Joined: 12-October 09
  • Location:Croatia

Posted 16 January 2013 - 03:57 PM

Hi and welcome to the Yii forum...

You added there two strange rules, try to remove the first two rules ('/'=>'' and 'site'=>'')
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   Mangoperson 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 16-January 13

Posted 17 January 2013 - 03:56 AM

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 ?
0

#4 User is offline   Mangoperson 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 16-January 13

Posted 17 January 2013 - 04:10 AM

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 .
0

#5 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,317
  • Joined: 12-October 09
  • Location:Croatia

Posted 17 January 2013 - 04:24 AM

Try to change the last htaccess line to

RewriteRule . index.php


or if it does not work to

RewriteRule ^.*$ index.php



Find more about me.... btw. Do you know your WAN IP?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users