使用phpnow本地搭建Discuz!如何实现伪静态

用phpnow本地搭建Discuz!如何实现伪静态
因为phpnow本身就支持伪静态,那只要看下相关的设置是否正确,写个.htaccess的文件就可以了。
一.确认httpd.conf的设置
在xxx\Apache-22\conf路径下找到httpd.conf,查找“rewrite”,确保开启了rewrite模块,即 “LoadModule rewrite_module modules/mod_rewrite.so”这一顶前面没有#号。PHPnow默认是开启的。
二.建一个.htaccess文件
新建个.htaccess文件放到网站的根目录。下面是代码:
RewriteBase /
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-([0-9]+)-([0-9]+)-1\.html$ forum.php?mod=viewthread&tid=$1&extra=page\={prevpage}&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$1:$2&%1

  

posted @ 2014-10-03 16:54  爱妻容易  阅读(449)  评论(0编辑  收藏  举报