Yii Framework Forum: Issue Using Showscriptname = False And Url Manager - Yii Framework Forum

Jump to content

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

Issue Using Showscriptname = False And Url Manager Rate Topic: -----

#1 User is offline   dty 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 30-December 10
  • Location:Mount Laurel, New Jersey

Posted 25 April 2013 - 04:16 PM

I am currently having an issue using the URL manager and/or the apache mod_rewrite or maybe something else entirely.

With showScriptName set to false, navigating to addresses such as domain.com/login, domain.com/logout, domain.com/site/login are all behaving the same way. It simply shows the main site/index, as if I were to navigate to domain.com/eeofjew9j8jfdedfmewf (jibberish).

Maybe it's an issue with my Yii settings? Here are those (sorry for the sloppiness):



	'components'=>array(
 		'urlManager'=>array(
 			'urlFormat'=>'path',
		'showScriptName'=>false,
		//'caseSensitive'=>false,
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
 				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
				'login'=>'site/login',
 				'logout'=>'site/logout',
				'register'=>'users/register'
			),
		),
...


Here is how I have my .htaccess setup in the www root:

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



I am using a VPS server, so I have root access to make any changes needed to apache. I've checked my phpinfo and mod_rewrite is running and enabled. In my apache config, I have for my www directory:

AllowOverride All
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all


I've been scratching my head on this issue through 3 different hosts (godaddy, dreamhost, and lithiumhosting) so I'm assuming it's an issue on my end with this. Now that I have a VPS though, I'm hoping I can finally figure out my issue and solve it.
0

#2 User is offline   lubosdz 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 112
  • Joined: 25-July 10
  • Location:Slovakia, Bratislava

Posted 26 April 2013 - 04:32 AM

Would this work?
(move generic patterns to the end so more specific rules apply first)

'components'=>array(
                'urlManager'=>array(
                'urlFormat'=>'path',
                'showScriptName'=>false,
                'rules'=>array(
                     'login/*'=>'site/login',
                     'logout/*'=>'site/logout',
                     'register/*'=>'users/register'
                     '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                     '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                     '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
      ),
)

Yii extension: Captcha Extended

Greatest discoveries in 22nd century will be about the gravitation. | http://www.synet.sk | http://ipdf.sk
0

#3 User is offline   dty 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 30-December 10
  • Location:Mount Laurel, New Jersey

Posted 26 April 2013 - 09:50 PM

View Postlubosdz, on 26 April 2013 - 04:32 AM, said:

Would this work?
(move generic patterns to the end so more specific rules apply first)

'components'=>array(
                'urlManager'=>array(
                'urlFormat'=>'path',
                'showScriptName'=>false,
                'rules'=>array(
                 	'login/*'=>'site/login',
                 	'logout/*'=>'site/logout',
                 	'register/*'=>'users/register'
                 	'<controller:\w+>/<id:\d+>'=>'<controller>/view',
                 	'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                 	'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
      ),
)



No luck. I've tried many combinations of ordering and commenting out all of the rules that I have there with no success. At one point, I just had '/login' => 'site/login' and it still would not work. Although when I set showScriptName to true, then domain.com/index.php/login worked fine.
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