<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>