本帖最後由 IT_man 於 2014-12-25 11:19 編輯
8 L _! o0 i- j: r" R# O- Y) z5 ?: R. b; K% d, }
在此分為「Host server設定」及「Discuz 後台設定」
% t) o$ h4 K. P( T8 \. ~4 q【Host server設定】 又分為Web server及站台根目錄下的.htaccess% y/ Z6 @+ G C' c, A
Web server 註:有個地方須注意,/etc/httpd/conf/httpd.conf中<Directory "/www/coav4u/test"> 的 AllowOverride 一定要all,.htaccess才有作用
$ ~( w8 S- Y/ o" p. B
) q: i, z7 K. _3 |% z: E 站台根目錄下的.htaccess- # -FrontPage-
' V2 P# N- j E8 E9 T) B - IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* 1 E# s. N. Q- g% t$ L4 `7 [+ R$ L
- # disable directory browsing
3 S" M/ T* Z$ a - Options All -Indexes
- i; w$ p9 J% P6 I7 e - RewriteEngine On # 將 RewriteEngine 模式打開8 e* K. ^: c1 J
- RewriteBase / #設定為網站的根目錄
3 D4 A+ K6 \9 U% K* s - #- k6 ^. T2 g0 ~5 s
- RewriteCond %{HTTP_HOST} ^av4u.info [NC]
" G. D/ N8 s! c7 D9 b - RewriteRule ^(.*)$ HTTP://www.av4u.info/$1 [L]<font face="楷體,標楷體"><font size="3">RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1# l x2 [1 {3 g$ n) y" _
- RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1" F# `3 W n. y& Q6 Y
- RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1. M' R; L5 Y* g2 V B$ q4 E8 N, ~
- RewriteRule; |1 i7 y( R& I9 I$ C* J$ i$ L
- ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$
$ E1 | z. ~- M9 z8 F - forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%13 Z' _* d6 `" V q/ |0 u) r
- RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1* g/ d( `7 }% \
- RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
4 D( {, f* \+ R' {, I& z - RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1- A, N4 d7 O6 k. \" T6 a! B. F
- RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1</font></font>
複製代碼 存檔後馬上生效
8 K y7 m0 t2 C- I9 V. [ 5 ~: P9 Q3 }9 [# n
【Discuz 後台設定】 後台->全局->SEO設置->URL靜態化
- B/ Y) j) E2 j7 M' Z: X: o
. i d7 P3 w; `" i9 j# S
可以全選或依據網站需要勾選
' W, b# f3 H+ Q5 g5 F7 i$ r
t: z/ I9 V7 s+ {' G |
|