Board logo

标题: [分享] linux下主流网站的伪静态规则 想要就进来拿吧!! [打印本页]

作者: marquis    时间: 2012-7-20 14:56     标题: 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>



  持续更新中 。。。。。(更新放在楼下)
作者: huzs1622    时间: 2012-7-20 15:33

支持楼主的分享精神!
作者: 藤真    时间: 2012-7-20 15:59

收藏了,支持楼主!!
作者: marquis    时间: 2012-7-20 17:08

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>
作者: qq682907    时间: 2012-10-14 13:25

怎么没有nginx? 我要DZ2.5的 完整版的。
作者: happyxinqiang    时间: 2012-11-16 16:26

Joomla的,急需啊~
作者: upchum    时间: 2013-1-31 14:04

这个wordpress是有一个问题的:wp-admin后台也会静态化,就会出现问题
作者: 3g210    时间: 2013-3-19 09:05

回复 1# marquis

我是nginx+apache 表示nginx+apache+php+mysql的组合的,是用nginx或者apache哪个伪静态规则呢
作者: marquis    时间: 2013-3-19 10:34

apache。。。。




欢迎光临 WDlinux官方论坛 (http://wdlinux.cn/bbs/) Powered by Discuz! 7.2