本帖最後由 IT_man 於 2014-12-25 11:19 編輯 % a `' a, M9 D
, Y# @. x# i4 B/ v4 e+ T$ O4 l在此分為「Host server設定」及「Discuz 後台設定」0 E; Z9 L4 W9 O4 P0 l
【Host server設定】 又分為Web server及站台根目錄下的.htaccess
4 ?8 V# G6 t7 ]" a. [/ P( h Web server 註:有個地方須注意,/etc/httpd/conf/httpd.conf中<Directory "/www/coav4u/test"> 的 AllowOverride 一定要all,.htaccess才有作用
" p6 c b, X6 i/ h( a9 j' `+ N* P6 V4 o# A/ ^
站台根目錄下的.htaccess- # -FrontPage-
6 v* ~ `# u2 P) I: P3 Y - IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
' _' k. [. c- u+ t' D: n3 f+ W) y - # disable directory browsing
5 r1 Z8 \* [6 [ - Options All -Indexes
" T% s; _' ]6 L - RewriteEngine On # 將 RewriteEngine 模式打開: c; w6 U7 W7 u i' [ r# e- R& S
- RewriteBase / #設定為網站的根目錄+ K* I3 }+ d- u& z+ b+ E1 z
- #! p9 }3 x" j8 c; F2 @8 Z1 h; }
- RewriteCond %{HTTP_HOST} ^av4u.info [NC]
6 U5 u3 {- ~( R* `. V' } - RewriteRule ^(.*)$ HTTP://www.av4u.info/$1 [L]<font face="楷體,標楷體"><font size="3">RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
; _% q$ ^# F: z5 n2 _4 w2 j0 ~4 k - RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
( Q F, ]* |5 a - RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%13 i$ \: W5 x: t) L3 A
- RewriteRule0 T0 h6 }1 P- }" E& M* v
- ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ ( E5 e( l$ m W5 n2 U. Y
- forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
5 X0 I& }' a5 c' [3 p6 O6 t) \' P - RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1: X+ M+ Z' Q O9 v: D4 _( V3 ^; I
- RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
) ~/ U5 F0 @/ v1 j: E4 g - RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
: W7 d v& o% P3 p9 A - RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1</font></font>
複製代碼 存檔後馬上生效
9 Q: y3 t3 S4 \
& E# P" }3 A% T" |1 X! s【Discuz 後台設定】 後台->全局->SEO設置->URL靜態化0 x5 P- O8 y r% p; t6 Z
- `, S" Z$ c! z) n3 n" D可以全選或依據網站需要勾選
9 }% w$ c2 S) e6 E; t; J9 X, D4 B1 k
" f, t) @1 K7 [! m, T |
|