Yii Framework Forum: Url Rewriting Issue - Yii Framework Forum

Jump to content

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

Url Rewriting Issue I want to rewrite my yii application urls Rate Topic: -----

#1 User is offline   Sanjaymv 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 14-January 14

Posted 14 January 2014 - 01:44 AM

I want to rewrite my yii application urls ,i just doen it and it works fine in my local machine . but when i move to server it is not working and shows a 500 Internal Server error

Here is my code in config/main.php
'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>',
                                    ),
                            ),


And here is my .htaccess code

RewriteEngine On
RewriteBase /home/bridge/public_html/cvdb/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]



Here what i get whjen i put var_dumb($_SERVER)

array(39) {
  ["DOCUMENT_ROOT"]=>
  string(29) "/home/bridge/public_html/cvdb"
  ["GATEWAY_INTERFACE"]=>
  string(7) "CGI/1.1"
  ["HTTP_ACCEPT"]=>
  string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
  ["HTTP_ACCEPT_LANGUAGE"]=>
  string(14) "en-US,en;q=0.5"
  ["HTTP_CONNECTION"]=>
  string(5) "close"
  ["HTTP_COOKIE"]=>
  string(339) "fbm_1=base_domain=.cvdb.xxx-xxx.com; PHPSESSID=a6b697793d5abf01012435cf868a2f13; 52862fa7c29cebef614e5f38c01514c2=5571bdfdfdfdfdfdfb1ed61d4cae29f6145035a37a9d4ee45e83a%3A4%3A%7Bi%3A0%3Bs%3A1%3A%221%22%3Bi%3A1%3Bs%3A13%3A%22Administrator%22%3Bi%3A2%3Bi%3A31536000%3Bi%3A3%3Ba%3A1%3A%7Bs%3A4%3A%22role%22%3Bs%3A2%3A%2210%22%3B%7D%7D"
  ["HTTP_HOST"]=>
  string(23) "cvdb.xxx-xxx.com"
  ["HTTP_USER_AGENT"]=>
  string(72) "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0"
  ["HTTP_X_FORWARDED_FOR"]=>
  string(14) "220.336.5.3"
  ["HTTP_X_FORWARDED_HOST"]=>
  string(23) "cvdb.xxx-xxx.com"
  ["HTTP_X_FORWARDED_SERVER"]=>
  string(23) "cvdb.xxx-xxx.com"
  ["HTTP_X_REAL_IP"]=>
  string(14) "220.336.5.3"
  ["PATH"]=>
  string(13) "/bin:/usr/bin"
  ["PHPRC"]=>
  string(13) "/home/bridge/"
  ["QUERY_STRING"]=>
  string(0) ""
  ["REDIRECT_PHPRC"]=>
  string(13) "/home/bridge/"
  ["REDIRECT_STATUS"]=>
  string(3) "200"
  ["REDIRECT_UNIQUE_ID"]=>
  string(24) "UtTWkTIfkzwAAddfdFUWCbwAAAAD"
  ["REDIRECT_URL"]=>
  string(11) "/list/index"
  ["REMOTE_ADDR"]=>
  string(14) "220.227.90.185"
  ["REMOTE_PORT"]=>
  string(5) "43681"
  ["REQUEST_METHOD"]=>
  string(3) "GET"
  ["REQUEST_URI"]=>
  string(11) "/list/index"
  ["SCRIPT_FILENAME"]=>
  string(39) "/home/bridge/public_html/cvdb/index.php"
  ["SCRIPT_NAME"]=>
  string(10) "/index.php"
  ["SERVER_ADDR"]=>
  string(12) "50.31.147.60"
  ["SERVER_ADMIN"]=>
  string(33) "webmaster@cvdb.xxx-xxx.com"
  ["SERVER_NAME"]=>
  string(23) "cvdb.xxx-xxx.com"
  ["SERVER_PORT"]=>
  string(2) "80"
  ["SERVER_PROTOCOL"]=>
  string(8) "HTTP/1.0"
  ["SERVER_SIGNATURE"]=>
  string(0) ""
  ["SERVER_SOFTWARE"]=>
  string(156) "Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_python/3.3.1 Python/2.4.3 mod_jk/1.2.37 mod_bwlimited/1.4 mod_perl/2.0.6 Perl/v5.8.8"
  ["UNIQUE_ID"]=>
  string(24) "UtTWkTIfkzwAAFUWCbwAAAAD"
  ["ORIG_PATH_INFO"]=>
  string(11) "/list/index"
  ["ORIG_PATH_TRANSLATED"]=>
  string(39) "/home/bridge/public_html/cvdb/index.php"
  ["PHP_SELF"]=>
  string(10) "/index.php"
  ["REQUEST_TIME"]=>
  int(1389680273)
  ["argv"]=>
  array(0) {
  }
  ["argc"]=>
  int(0)
}


Any one please help me to solve this issue...
0

#2 User is offline   Argent 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 83
  • Joined: 23-February 13
  • Location:Hungary

Posted 14 January 2014 - 04:31 AM

Try this htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

or
RewriteEngine On
RewriteBase /cvdb/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php


the RewriteBase is not an absolute file system path - this is an url path.
0

#3 User is offline   Sanjaymv 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 14-January 14

Posted 14 January 2014 - 06:00 AM

View PostArgent, on 14 January 2014 - 04:31 AM, said:

Try this htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

or
RewriteEngine On
RewriteBase /cvdb/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php


the RewriteBase is not an absolute file system path - this is an url path.


Hi i just try both but didn't get the result
When i try the first i got the error like The page isn't redirecting properly.
For the second the same issue 500 internal server error
0

#4 User is offline   Matthew Torres 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 12-February 14

Posted 26 February 2014 - 03:32 AM

What is your server?
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