本帖最後由 IT_man 於 2014-12-25 11:19 編輯
! c7 w. v' R! A6 e' p( i) M' n+ c$ p) y/ A, H& [6 L4 x6 S1 |9 `' G7 ^
在此分為「Host server設定」及「Discuz 後台設定」" a! p0 H1 U/ o5 V
【Host server設定】 又分為Web server及站台根目錄下的.htaccess
/ K# |- Y/ w( r$ e3 K# E' d Web server 註:有個地方須注意,/etc/httpd/conf/httpd.conf中<Directory "/www/coav4u/test"> 的 AllowOverride 一定要all,.htaccess才有作用
, {+ j3 T% N! O* u; O% s Z1 U; k' e! L, o0 x/ _7 ?( @4 o
站台根目錄下的.htaccess- # -FrontPage-
' ~( N$ n+ P# G' c7 j8 ~, | - IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
9 f9 R8 V/ H! L; E& [ - # disable directory browsing; y& Z! _( _+ ]" F: s4 z
- Options All -Indexes, V' {0 r- j3 j
- RewriteEngine On # 將 RewriteEngine 模式打開
0 \8 m2 L* Z" `1 D, s) v - RewriteBase / #設定為網站的根目錄
( f( Y" |! O- o* r0 z - #1 H* P) g( B9 X) f6 a- Y$ e
- RewriteCond %{HTTP_HOST} ^av4u.info [NC]- t: L. B& O1 b, ^' z. ^
- RewriteRule ^(.*)$ HTTP://www.av4u.info/$1 [L]<font face="楷體,標楷體"><font size="3">RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
$ N5 M; _; W- f$ g - RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1; u L. f3 H/ K; a$ S8 P
- RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%15 ]5 `. m$ \9 b" e( q: H& K6 ~
- RewriteRule" P% _1 e% e5 @: e2 q
- ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$
$ ^5 N& J% x+ y/ _& U" u+ q - forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
# A1 f0 ]0 @% J* U! V) H - RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1) g, |; N7 b- e; d' _ ?+ e0 ^
- RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1! Y2 F! O# y5 O& W9 s7 [
- RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
5 ]# \5 ^% ?5 z- I% P# g! y - RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1</font></font>
複製代碼 存檔後馬上生效! ^7 h$ Q, `# D. e0 h
! N; g' `5 D8 E9 N9 q, k4 K! n/ I【Discuz 後台設定】 後台->全局->SEO設置->URL靜態化( U a5 F; c" m% {' A* K
. a j5 R$ p5 w4 j% K2 m可以全選或依據網站需要勾選6 I9 b1 _2 q4 G5 [
4 T: l9 Q2 P) w0 _/ f( `6 Q+ X. Q |
|