0

I have a Web application setup on EC2 using Yii framework. When I transfer my files on EC2 instance I am getting this error

CException

The URL pattern "<controller:\w+>/<id:\d+>" for route "<controller>/view" is not a valid regular expression.

/var/www/html/framework/web/CUrlManager.php(700)

my URL rules in main.php are

'urlManager'=>array(
            'urlFormat'=>'path',
            'rules'=>array(
                '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ),
        ),

I have a controller named as "ApiController.php" in controllers folder. On my local machine it works fine but the problem is on EC2 instance.

These are the some config in main.php

'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
    'name'=>'AppName',
    'defaultController'=>'Api',
5
  • can you tell me the type of url that is generating this url? even if it is all kinds, it'll help to get an example Commented Aug 10, 2012 at 11:40
  • I tried to access this xxx.xx.xxx.xxx and then this xxx.xx.xxx.xxx/api/index and Please see the update in my question and see if you can help Commented Aug 10, 2012 at 11:47
  • ok, do you have a root url that needs no urlmanagement for this app (in the yii sense)?, i mean since this is some sort of api, do you have a browser accessible root url for it? if yes, then does that root url work without problems? Commented Aug 10, 2012 at 11:49
  • 1
    Yeah I have browser accessible url for it like a public ip associated with EC2 instance. And accessing the root url gives same error like all others Commented Aug 10, 2012 at 11:53
  • i just got this problem myself, solved it with a restart! you can check my posts in this forum topic to understand how i arrived at the restart! Commented Aug 17, 2012 at 13:05

1 Answer 1

1

To answer my own question using this as the .htaccess removes the error

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
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.