Monday, May 7, 2012

Yii Url Manager Configuration

Normal Url Manager
To Hide index.php
Add following source codes in .htaccess Note:Dont change .htaccess file inside protected Note:Create .htaccess file outside protectd folder Souce code for .htaccess
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

Output Url:http://localhost/sample/site/index

 
?>

4 comments:

  1. No, We can rewrite the every action url

    ReplyDelete
    Replies
    1. I have problem if the primary key is varchar,

      the problem is urlManager cannot find the true path
      eg : http://xxxxx/site/in...item/update/ABC
      or http://xxxxx/site/index.php/item/ABC

      ABC is id (varchar)

      Delete
    2. The "id" should be integer

      Delete