![](/img/trans.png)
[英]Change example.com/dashboard.php to example.com/index.php?action=dashboard
[英]How to change example.com/index.php/lib to example.com/lib?
我正在使用Yii 1.1编写的站点,Web服务器是apache2。目前,我必须解决以下问题:
有URL,每个URL都提供模块。 1)example.com/index.php/library 2)example.com/index.php/sys
如何将这些网址更改为
1)example.com/library 2)example.com/sys
那就是我如何从URL index.php?
谢谢 !
在网址管理器的Yii Framework页面中对此进行了说明
您需要做三件事才能在apache server
实现这一目标。
1)在您的apache conf
文件中启用url_rewriting
2)使用此.htaccess
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
3)在您的main.php
配置urlmanager
'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>'),
1)首先将其包括到虚拟主机的设置中: AllowOverride All
2)并添加以下几行:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
3)在config / main.php中:
urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>**false**
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.