无标题文档
wdCP系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用教程) wdCDN系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用手册)
wdOS系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用教程) wdDNS系统 (介绍,功能特性,运行环境,安装说明,演示,常见问题,使用手册)
注册 发贴 提问 回复-必看必看 wddns免费智能 DNS 开通 本地或虚拟机使 用wdcp 一键包在mysql编 译时"卡住"
【300G高防】双线 无视攻击 wdcp官方技术支持/服务 阿里云8折优惠券 无敌云 腾讯云优惠中,现注册更有260代金额券赠送
返回列表 发帖
提问三步曲: 提问先看教程/FAQ索引(wdcp,wdcp_v3,一键包)及搜索,会让你更快解决问题
1 提供详细,如系统版本,wdcp版本,软件版本等及错误的详细信息,贴上论坛或截图发论坛
2 做过哪些操作或改动设置等

温馨提示:信息不详,很可能会没人理你!论坛有教程说明的,也可能没人理!因为,你懂的

[分享] linux下主流网站的伪静态规则 想要就进来拿吧!!

本帖最后由 marquis 于 2012-7-25 11:42 编辑

这里收集的都是主流网站源码包的伪静态规则
wdcp已经默认添加了dzx15,dzx7的nginx和apache伪静态规则了
在nginx下的伪静态规则
   wordpress
  location / {
        index index.html index.php;
        if (-f $request_filename/index.html){
            rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename/index.php){
            rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
            rewrite (.*) /index.php;
        }
    }


  shopex
location / {
if (!-e $request_filename) {
rewrite ^/(.+.(html|xml|json|htm|php|jsp|asp|shtml))$ /index.php?$1 last;
         }
}




  phpcms
location / {
###以下为PHPCMS 伪静态化rewrite规则
rewrite ^(.*)show-([0-9]+)-([0-9]+).html$ $1/show.php?itemid=$2&page=$3;
rewrite ^(.*)list-([0-9]+)-([0-9]+).html$ $1/list.php?catid=$2&page=$3;
rewrite ^(.*)show-([0-9]+).html$ $1/show.php?specialid=$2;

####以下为PHPWind 伪静态化rewrite规则
rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
rewrite ^(.*)/simple/([a-z0-9_]+.html)$ $1/simple/index.php?$2 last;
}


  emlog4.0
location / {
        index index.php index.html;
        if (!-e $request_filename)
        {
                rewrite ^/(.+)$ /index.php last;
        }
}





  phpwind
location / {
rewrite ^(.*)-htm-(.*)$ $1.php?$2 last;
rewrite ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2 last;
}




  SaBlog2.0
# 只带月份的归档
rewrite "^/date/([0-9]{6})/?([0-9]+)?/?$" /index.php?action=article&setdate=$1&page=$2 last;
# 无分类翻页
rewrite ^/page/([0-9]+)?/?$ /index.php?action=article&page=$1 last;
# 分类
rewrite ^/category/([0-9]+)/?([0-9]+)?/?$ /index.php?action=article&cid=$1&page=$2 last;
rewrite ^/category/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&curl=$1&page=$2 last;
# 归档、高级搜索
rewrite ^/(archives|search|article|links)/?$ /index.php?action=$1 last;
# 全部评论、标签列表、引用列表 带分页
rewrite ^/(comments|tagslist|trackbacks|article)/?([0-9]+)?/?$ /index.php?action=$1&page=$2 last;
# tags
rewrite ^/tag/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&item=$1&page=$2 last;
# 文章
rewrite ^/archives/([0-9]+)/?([0-9]+)?/?$ /index.php?action=show&id=$1&page=$2 last;
# RSS rewrite ^/rss/([0-9]+)?/?$ /rss.php?cid=$1 last;
rewrite ^/rss/([^/]+)/?$ /rss.php?url=$1 last;
# 用户 rewrite ^/uid/([0-9]+)/?([0-9]+)?/?$ /index.php?action=article&uid=$1&page=$2 last;
rewrite ^/user/([^/]+)/?([0-9]+)?/?$ /index.php?action=article&user=$1&page=$2 last;
# 地图文件
rewrite sitemap.xml sitemap.php last;
# 自定义链接
rewrite ^(.*)/([0-9a-zA-Z\-\_]+)/?([0-9]+)?/?$ $1/index.php?action=show&alias=$2&page=$3 last;


  Typecho
location / {
        index index.html index.php;
        if (-f $request_filename/index.html){
            rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename/index.php){
            rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
            rewrite (.*) /index.php;
        }
    }








在apache下的伪静态规则

  DEDE
<IfModule mod_rewrite.c>
       RewriteEngine On
RewriteRule ^plus/list-([0-9]+)\.html$ /plus/list.php?tid=$1
RewriteRule ^plus/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /plus/list.php?tid=$1&totalresult=$2&PageNo=$3
RewriteRule ^plus/view-([0-9]+)-1\.html$ /plus/view.php?arcID=$1
RewriteRule ^plus/view-([0-9]+)-([0-9]+)\.html$ /plus/view.php?aid=$1&pageno=$2



</IfModule>


  dzx2.5
<IfModule mod_rewrite.c>
       ewriteEngine On
       RewriteBase /

# Rewrite 系统规则请勿修改

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]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&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 ^([a-z]+)-(.+)\.html$ $1.php?rewrite=$2&%1

</IfModule>



  phpwind
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)/thread-htm-tid-(\d+)-(.*).html  $1/thread.php?fid=$2
RewriteRule ^(.*)/read-htm-tid-(\d+)-(.*).html  $1/read.php?tid=$2
RewriteRule ^(.*)/commtopics-(\d+)-(.*)$ $1/thread.php?fid=$2&page=$3
RewriteRule ^(.*)/commtopics-(.*)$      $1/thread.php?fid=$2&page=$3
RewriteRule ^(.*)/article-(\d+)-(\d+)-(.*).html$  $1/read.php?tid=$2&page=$3&fpage=$4
RewriteRule ^(.*)/article-(\d+)-(.*).html$       $1/read.php?tid=$2&page=$3
RewriteRule ^(.*)/article-(.*).html$         $1/read.php?tid=$2
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
</IfModule>



  wordpress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>



  持续更新中 。。。。。(更新放在楼下)

apache。。。。

TOP

回复 1# marquis

我是nginx+apache 表示nginx+apache+php+mysql的组合的,是用nginx或者apache哪个伪静态规则呢

TOP

这个wordpress是有一个问题的:wp-admin后台也会静态化,就会出现问题

TOP

Joomla的,急需啊~

TOP

怎么没有nginx? 我要DZ2.5的 完整版的。

TOP

zencart的apache伪静态规则
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# From Ultimate SEO URLs
RewriteRule ^(.*)-p-(.*).html$ index\.php?main_page=product_info&amp;products_id=$2&amp;%{QUERY_STRING} [L]RewriteRule ^(.*)-c-(.*).html$ index\.php?main_page=index&amp;cPath=$2&amp;%{QUERY_STRING} [L]
RewriteRule ^(.*)-m-([0-9]+).html$ index\.php?main_page=index&amp;manufacturers_id=$2&amp;%{QUERY_STRING} [L]
RewriteRule ^(.*)-pi-([0-9]+).html$ index\.php?main_page=popup_image&amp;pID=$2&amp;%{QUERY_STRING} [L]RewriteRule ^(.*)-pr-([0-9]+).html$ index\.php?main_page=product_reviews&amp;products_id=$2&amp;%{QUERY_STRING} [L]
RewriteRule ^(.*)-pri-([0-9]+).html$ index\.php?main_page=product_reviews_info&amp;products_id=$2&amp;%{QUERY_STRING} [L]
# For Open Operations Info Manager<br />RewriteRule ^(.*)-i-([0-9]+).html$ index\.php?main_page=info_manager&amp;pages_id=$2&amp;%{QUERY_STRING} [L]
# For dreamscape's News &amp; Articles Manager
RewriteRule ^news$ index\.php?main_page=news&amp;%{QUERY_STRING} [L]
RewriteRule ^news/rss.xml$ index\.php?main_page=news_rss&amp;%{QUERY_STRING} [L]
RewriteRule ^news/archive$ index\.php?main_page=news_archive&amp;%{QUERY_STRING} [L]
RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html$ index\.php?main_page=news&amp;date=$1-$2-$3&amp;%{QUERY_STRING} [L]
RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html$ index\.php?main_page=news_archive&amp;date=$1-$2&amp;%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+)-comments.html$ index\.php?main_page=news_comments&amp;article_id=$2&amp;%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+).html$ index\.php?main_page=news_article&amp;article_id=$2&amp;%{QUERY_STRING} [L]
RewriteRule ^-ezp-(.*).html$ index\.php?main_page=page&amp;id=$1&amp;%{QUERY_STRING} [L]
# All other pages
# Don't rewrite real files or directories
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html$ index\.php?main_page=$1&amp;%{QUERY_STRING} [L]
</IfModule>

TOP

收藏了,支持楼主!!

TOP

支持楼主的分享精神!
huzs.net

TOP

返回列表