<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^index$    index\.php [L]
RewriteRule ^welcome$  index\.php [QSA,L]
RewriteRule ^me$  u\.php\?action=me [QSA,L]

#会员空间
RewriteRule ^u/all$  u\.php\?action=all [QSA,L]
RewriteRule ^u/message/(\d+)$  u\.php\?action=message&page=$1 [QSA,L]
RewriteRule ^u/message$  u\.php\?action=message [QSA,L]
RewriteRule ^u/([a-z]+)/([a-z]+)/(\d+)/(\d+)$  u\.php\?action=$1&$2=$3&page=$4 [QSA,L]
RewriteRule ^u/([a-z]+)/([a-z]+)/(\d+)$  u\.php\?action=$1&$2=$3 [QSA,L]
RewriteRule ^u/(\d+)/([a-z]+)/([a-z]+)/([a-z]+)/(\d+)$  u\.php\?action=$2&uid=$1&type=$3&sort=$4&page=$5 [QSA,L]
RewriteRule ^u/(\d+)/([a-z]+)/([a-z]+)/([a-z]+)$  u\.php\?action=$2&uid=$1&type=$3&sort=$4 [QSA,L]
RewriteRule ^u/(\d+)/([a-z]+)/([a-z]+)/(\d+)$  u\.php\?action=$2&uid=$1&type=$3&page=$4 [QSA,L]
RewriteRule ^u/(\d+)/([a-z]+)/([a-z]+)$  u\.php\?action=$2&uid=$1&type=$3 [QSA,L]
RewriteRule ^u/(\d+)/([a-z]+)/(\d+)$  u\.php\?action=$2&uid=$1&page=$3 [QSA,L]
RewriteRule ^u/(\d+)/([a-z]+)$  u\.php\?action=$2&uid=$1 [QSA,L]
RewriteRule ^u/(\d+)/(\d+)$  u\.php\?action=index&uid=$1&page=$2 [QSA,L]
RewriteRule ^u/(\d+)$  u\.php\?action=index&uid=$1 [QSA,L]

#club模块
RewriteRule ^club/newtopic/(\d+)$  club\.php\?action=newtopic&fid=$1 [QSA,L]
RewriteRule ^club/newtopic$  club\.php\?action=newtopic [QSA,L]

RewriteRule ^club/detail/(\d+)/(\d+)$  club\.php\?action=detail&tid=$1&page=$2 [QSA,L]
RewriteRule ^club/detail/(\d+)$  club\.php\?action=detail&tid=$1 [QSA,L]

RewriteRule ^club/best/(\d+)/([a-z]+)/(\d+)$  club\.php\?action=best&fid=$1&sort=$2&page=$3 [QSA,L]
RewriteRule ^club/best/(\d+)/([a-z]+)$  club\.php\?action=best&fid=$1&sort=$2 [QSA,L]
RewriteRule ^club/best/(\d+)/(\d+)$  club\.php\?action=best&fid=$1&page=$2 [QSA,L]
RewriteRule ^club/best/(\d+)$  club\.php\?action=best&fid=$1 [QSA,L]

RewriteRule ^club/(\d+)/([a-z]+)/(\d+)$  club\.php\?action=forum&fid=$1&sort=$2&page=$3 [QSA,L]
RewriteRule ^club/(\d+)/([a-z]+)$  club\.php\?action=forum&fid=$1&sort=$2 [QSA,L]
RewriteRule ^club/(\d+)/(\d+)$  club\.php\?action=forum&fid=$1&page=$2 [QSA,L]
RewriteRule ^club/(\d+)$  club\.php\?action=forum&fid=$1 [QSA,L]

RewriteRule ^club$  club\.php\?action=index [QSA,L]

#ask模块
RewriteRule ^ask/newtopic/(\d+)$  ask\.php\?action=newtopic&aid=$1 [QSA,L]
RewriteRule ^ask/newtopic$  ask\.php\?action=newtopic [QSA,L]

RewriteRule ^ask/(\d+)/([a-z]+)/(\d+)/$  ask\.php\?action=forum&aid=$1&type=$2&page=$3 [QSA,L]
RewriteRule ^ask/(\d+)/([a-z]+)$  ask\.php\?action=forum&aid=$1&type=$2 [QSA,L]
RewriteRule ^ask/(\d+)/(\d+)$  ask\.php\?action=forum&aid=$1&page=$2 [QSA,L]
RewriteRule ^ask/(\d+)$  ask\.php\?action=forum&aid=$1 [QSA,L]

RewriteRule ^ask/detail/(\d+)/(\d+)$  ask\.php\?action=detail&tid=$1&page=$2 [QSA,L]
RewriteRule ^ask/detail/(\d+)$  ask\.php\?action=detail&tid=$1 [QSA,L]

RewriteRule ^ask$  ask\.php\?action=index [QSA,L]

#产品筛选页
RewriteRule ^book/shopping/(new|pop|hot7|hot30)/([^\/]+)/(\d+)$  book\.php?action=shopping&sort=$1&tag=$2&page=$3 [QSA,L]
RewriteRule ^book/shopping/(new|pop|hot7|hot30)/(\d+)$  book\.php?action=shopping&sort=$1&page=$2 [QSA,L]
RewriteRule ^book/shopping/(new|pop|hot7|hot30)/([^\/]+)$  book\.php?action=shopping&sort=$1&tag=$2 [QSA,L]
RewriteRule ^book/shopping/(new|pop|hot7|hot30)$  book\.php?action=shopping&sort=$1 [QSA,L]
RewriteRule ^book/shopping/([^\/]+)/(\d+)$  book\.php?action=shopping&tag=$1&page=$2 [QSA,L]
RewriteRule ^book/shopping/(\d+)$  book\.php?action=shopping&page=$1 [QSA,L]
RewriteRule ^book/shopping/([^\/]+)$  book\.php?action=shopping&tag=$1 [QSA,L]
RewriteRule ^book/shopping$  book\.php?action=shopping [QSA,L]

RewriteRule ^book/([a-z]+)/(new|pop|hot7|hot30)/([^\/]+)/(\d+)$  book\.php?action=cate&cate=$1&sort=$2&tag=$3&page=$4 [QSA,L]
RewriteRule ^book/([a-z]+)/(new|pop|hot7|hot30)/(\d+)$  book\.php?action=cate&cate=$1&sort=$2&page=$3 [QSA,L]
RewriteRule ^book/([a-z]+)/(new|pop|hot7|hot30)/([^\/]+)$  book\.php?action=cate&cate=$1&sort=$2&tag=$3 [QSA,L]
RewriteRule ^book/([a-z]+)/(new|pop|hot7|hot30)$  book\.php?action=cate&cate=$1&sort=$2 [QSA,L]
RewriteRule ^book/([a-z]+)/([^\/]+)/(\d+)$  book\.php?action=cate&cate=$1&tag=$2&page=$3 [QSA,L]
RewriteRule ^book/([a-z]+)/(\d+)$  book\.php?action=cate&cate=$1&page=$2 [QSA,L]
RewriteRule ^book/([a-z]+)/([^\/]+)$  book\.php?action=cate&cate=$1&tag=$2 [QSA,L]
RewriteRule ^book/([a-z]+)$  book\.php?action=cate&cate=$1 [QSA,L]

#分享详细页
RewriteRule ^note/(\d+)/(g|m)/(\d+)$  note\.php?action=$2&sid=$1&id=$3 [QSA,L]
RewriteRule ^note/(\d+)$  note\.php?action=index&sid=$1 [QSA,L]

#达人
RewriteRule ^daren/(\d+)$  daren\.php\?action=index&page=$1 [QSA,L]
RewriteRule ^daren$  daren\.php?action=index [QSA,L]
RewriteRule ^daren/all/(\d+)$  daren\.php\?action=all&page=$1 [QSA,L]
RewriteRule ^daren/all$  daren\.php?action=all [QSA,L]

#其他
RewriteRule ^([a-z]+)/([a-z]+)$  $1\.php\?action=$2 [QSA,L]
</IfModule>