这是我的设置:
配置文件
'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>'
),
'showScriptName'=>false,
),
.htaccess:
Options +FollowSymlinks
#+FollowSymLinks must be enabled for any rules to work, this is a security
#requirement of the rewrite engine. Normally it's enabled in the root and we
#shouldn't have to add it, but it doesn't hurt to do so.
RewriteEngine on
#Apache scans all incoming URL requests, checks for matches in our
#.htaccess file
#and rewrites those matching URLs to whatever we specify.
#allow blank referrers.
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.dev [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?dev.site.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
# 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
在布局菜单上我有这个:
$this->widget('zii.widgets.CMenu',
array('items'=>
array(
array(
'label'=>Yii::t('site','A'),
'url'=>array('/site/index')
),
array(
'label'=>Yii::t('site','Q'),
'url'=>array('rooms/index')
),
array(
'label'=>Yii::t('site','G'),
'url'=>array('gastronomy/index')
),
array(
'label'=>Yii::t('site','A'),
'url'=>array('activity/index')
),
array(
'label'=>Yii::t('site','S'),
'url'=>array('services/index')
),
array(
'label'=>Yii::t('site','C'),
'url'=>array('contacts/index')
),
array(
'label'=>Yii::t('site','R'),
'url'=>array('booking/index')
)
)
)
);
我在这里显式调用索引,因为看起来,显式调用它是必需的。
有了这个设置,每次我点击我得到的那些链接,例如:
虽然我希望得到:
没有索引名称。
我在这里想念什么?