【发布时间】:2014-06-23 02:22:50
【问题描述】:
我有一个网站,我想要像SiteURL/about.html. 这样的网址
我已经更改了config/main.php 中的代码,但是当我登录到站点时,当我导航到任何其他页面时,会话就会过期。
如果在config/main.php 文件中注释此代码'showScriptName'=>false,那么它工作正常,现在我的登录会话被保存并且我们没有过期但是现在我的URL 变成了这样SiteURL/index.php/about.html
但我想要像about.html.这样的网址
我还有另一个用于游戏选项的控制器,其 URL 类似于:http://www.demo.com/index.php/Games/info/9.html,但我希望 URL 像 SiteURL/black-hook.html 在这个“black-hook”是游戏的名称。
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>FALSE,
'rules'=>array(
'<action>'=>'site/<action>',
'<view>'=>'array('site/page')',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>'
),
),
*SiteURL = http://www.demo.com
【问题讨论】:
-
请发布您的 .htaccess。
-
顺便说一句。为什么是“.html”??? Yii 是基于 PHP 的!
标签: php yii url-rewriting yii-routing