[php]代码库
//在最外层config配置
'URL_MODEL' => 2, //2表示已经重写 0表示普通模式
'URL_ROUTER_ON' => true,
'URL_ROUTE_RULES' => array(
'c/:id' => 'Index/List/index',
's' => 'Index/Search/index',
'/^c_(\d+)$/' => 'Index/List/index?id=:1', //正则路由
':id\d' => 'Index/Show/index'
),
2.直接不要index.php 只需要域名+。。。如果进入后台域名/admin
一:改httpd.conf
AllowOverride all
#LoadModule rewrite_module modules/mod_rewrite.so//去掉#开启重写
二:在根目录写心建隐藏文件.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
三:重启Apache即可