RewriteEngine on
RewriteBase /

#栏目
RewriteRule ^channel-([0-9a-zA-Z]+)(-([0-9a-zA-Z]+))?\.html$ channel.php?channelid=$1&page=$3 [L]

#列表
RewriteRule ^list-(article|image|video|download)(-(newest|head|focus|recommend|scroll|image|txpic))?(-([0-9a-zA-Z]+))?\.html$ list.php?model=$1&type=$3&page=$5 [L]
RewriteRule ^list(-(newest|head|focus|recommend|scroll|image|txpic))?(-([0-9a-zA-Z]+))?\.html$ list.php?type=$2&page=$4 [L]
RewriteRule ^list-([0-9a-zA-Z]+)(-(newest|head|focus|recommend|scroll|image|txpic))?(-([0-9a-zA-Z]+)).html$ list.php?channelid=$1&type=$3&page=$5 [L]
RewriteRule ^list-([0-9a-zA-Z]+)-([0-9a-zA-Z]+)-(newest|head|focus|recommend|scroll|image|txpic)-([0-9a-zA-Z]+).html$ list.php?channelid=$1model=$2&type=$3&page=$4 [L]

#内容
RewriteRule ^content-([0-9a-zA-Z]+)(-([0-9a-zA-Z]+))?\.html$ content.php?contentid=$1&page=$3 [L]

#排行
RewriteRule ^top(\.html)?$ top.php [L]
RewriteRule ^top-(article|image|video|download)(-(day|week|month|year|all))?\.html$ top.php?model=$1&order=$3 [L]
RewriteRule ^top-([0-9a-zA-Z]+)(-(day|week|month|year|all))?\.html$ top.php?channelid=$1&order=$3 [L]

#Tag
RewriteRule ^tag(-([0-9]))?(-([A-Z]))?(-([0-9a-zA-Z]))?.html$ tag.php?cid=$2&initial=$4&page=$6 [L]
RewriteRule ^tag-([^/\w]+)(-([0-9a-zA-Z]+))?(\.html)?$ tag.php?name=$1&page=$3 [L]

#DIGG
RewriteRule ^digg(\.html)?$ digg.php [L]
RewriteRule ^digg-(day|week|month|all)(-([0-9a-zA-Z]+))?\.html$ digg.php?type=$1&page=$3 [L]
RewriteRule ^digg-([0-9a-zA-Z]+)-([0-9a-zA-Z]+)\.html$ digg.php?channelid=$1&page=$2 [L]
RewriteRule ^digg-(day|week|month|all)-([0-9a-zA-Z]+)(-([0-9a-zA-Z]+))?\.html$ digg.php?type=$1&channelid=$2&page=$4 [L]

#RSS
RewriteRule ^rss.html$ apps/action/rss.php [L]
RewriteRule ^rss(-([0-9a-zA-Z]+))?(-([0-9a-zA-Z]+))?.xml$ apps/action/rss.php?channelid=$2&html=$4 [L]

#图片,视频
RewriteRule ^pic.html$ pic.php [L]
RewriteRule ^video.html$ video.php [L]

#评论
RewriteRule ^comment(\.html)?$ comment.php [L]
RewriteRule ^comment-([0-9a-zA-Z]+)(-([0-9a-zA-Z]+))?\.html$ comment.php?contentid=$1&page=$3 [L]
RewriteRule ^comment-single-([0-9]+)?\.html comment.php?commentid=$1 [L]
RewriteRule ^comment-rank(-([A-Za-z]+))?\.html comment.php?type=rank&rank=$2 [L]
RewriteRule ^comment-(recommend|wonderful|hot|support|against)(-([0-9a-zA-Z]+))?(-([0-9a-zA-Z]+))?\.html$ comment.php?type=$1&contentid=$3&page=$5 [L]

#404页面
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^404.html$ 404.php?%1 [L]

#搜索
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^search? search.php?%1

#账户中心
RewriteRule ^account$ account/index.php [L]
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^account/login.html$ account/login.php?%1 [L]
RewriteRule ^account/logout.html$ account/login.php?action=logout [L]
RewriteRule ^account/islogin.html account/login.php?action=islogin [L]
RewriteRule ^account/register.html$ account/register.php [L]
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^account/verifycode.jpg$ account/verifycode.php?%1 [L]
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^account/recover.html$ account/recover.php?%1 [L]
RewriteRule ^account/profile(-([\s\S]*))?.html$ account/profile.php?type=$2 [L]
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^account/content.html$ account/content.php?%1 [L]
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^account/favorite.html$ account/favorite.php?%1 [L]
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^account/rank.html$ account/rank.php?%1 [L]
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^account/friend.html$ account/friend.php?%1 [L]
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^account/message.html$ account/message.php?%1 [L]

#问答
RewriteRule ^ask/category[/]?$ ask/list.php
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^ask/category/([A-Za-z]+)\.html? ask/list.php?type=$1&%1
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^ask/category/([0-9]+)(-([A-Za-z]+))?\.html? ask/list.php?cid=$1&type=$3&%1
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^ask/question/([0-9]+)\.html ask/question.php?id=$1&%1
RewriteCond %{QUERY_STRING} ([\s\S]*)$
RewriteRule ^ask/search?(.*) ask/search.php?%1