我希望讓警予無法掩飾進入網址
http://localhost/demo/index.php?r=greeting
通過
http://localhost/demo/greeting
訪問的config/main.php,我設置爲
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName' => false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
,我把在.htaccess之後
Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
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
</IfModule>
我能得到
http://localhost/demo/index.php/greeting
工作,但不
http://localhost/demo/greeting
工作的原因是什麼?
'http:// localhost/demo/greeting'不符合您的任何url規則。 「greeting」控制器的默認操作是什麼? – soju 2013-03-21 13:28:40
你用''有條件重寫,你確定重寫模塊被加載了嗎?這是什麼意思*不工作*,Apache錯誤或yii錯誤? –
2013-03-21 16:49:02