apache
1.在网站根目录创建文件 .htaccess,内容如下:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*?)([^/]*)$ $1index.php?$2[QSA,PT,L]
</IfModule>
2. 修改conf/conf.php,将url_rewrite_on 改成1
3. 清理缓存
nginx
- 在配置文件的server节点下新增如下内容:
location ~* \.(htm)$ {
rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last;
}
2. 修改conf/conf.php,将url_rewrite_on 改成1
3. 清理缓存