记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。

Apache伪静态(URL Rewrite)设置方法


一 打开 Apache 的配置文件 httpd.conf

二 将#LoadModule rewrite_module modules/mod_rewrite 前面的#去掉

三 在 httpd.conf中添加:


RewriteEngine On


# 伪静态规则保存到这里,以下为DZ论坛伪静态
RewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)\?*(.*)$ $1/archiver/index\.php\?$2&$4
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/forumdisplay\.php\?fid=$2&page=$3&$4
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$ $1/viewthread\.php\?tid=$2&extra=page\%3D$4&page=$3&$4
RewriteRule ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$ $1/space\.php\?$2=$3&$4
RewriteRule ^(.*)/tag-(.+)\.html\?*(.*)$ $1/tag\.php\?name=$2&$3




四 保存httpd.conf 并重启Apache




转载请标明出处【Apache伪静态(URL Rewrite)设置方法 】。

《www.micoder.cc》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论