记忆中的平凡 发表于 2017-3-9 15:37:04

apache通过URL重写伪静态方法!

一.Apache的基本设置方法!独立主机的用户Apache 基本配置:首先确定您使用的 Apache 版本,及是否加载了 mod_Rewrite 模块。Apache 1.x 的用户请检查 conf/httpd.conf 中是否存在如下两段代码:LoadModule Rewrite_module libexec/mod_Rewrite.soAddModule mod_Rewrite.cApache 2.x 的用户请检查 conf/httpd.conf 中是否存在如下一段代码:LoadModule Rewrite_module modules/mod_Rewrite.so如果没有安装 mod_Rewrite,您可以重新编译 Apache,并在原有 configure 的内容中加入 --enable-Rewrite=shared注:如果前面有#,将其去掉。方法一:通过配置Apache配置文件httpd.conf实现URL重写在配置文件(通常就是 conf/httpd.conf)中加入如下代码。<IfModule mod_Rewrite.c>RewriteEngine OnRewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2RewriteRule ^(.*)/forum-(+)-(+)\.html$ $1/forumdisplay.php?fid=$2&page=$3RewriteRule ^(.*)/thread-(+)-(+)-(+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2</IfModule>


哈哈哇 发表于 2017-3-14 11:30:32

完全不懂,但来真是学海无涯,谢谢楼主无私分享
页: [1]
查看完整版本: apache通过URL重写伪静态方法!