tid=193& 本帖最後由 IT_man 於 2014-12-25 11:19 編輯
% [5 H8 G8 i5 b5 W* C
$ L `7 ~1 k. e) b$ ^在此分為「Host server設定」及「Discuz 後台設定」, M6 x$ ^- ^# r/ l
【Host server設定】 又分為Web server及站台根目錄下的.htaccess, _$ r- x# {( |" o5 o7 @
Web server 註:有個地方須注意,/etc/httpd/conf/httpd.conf中<Directory "/www/coav4u/test"> 的 AllowOverride 一定要all,.htaccess才有作用
3 J, G5 {' I1 y
9 f' R0 } S" n$ ^* R+ n 站台根目錄下的.htaccess- # -FrontPage-% t5 d! b: L7 q- P/ w( o" X( Y* g" S
- IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
3 q8 X7 W1 E6 c2 h6 T% ]5 w - # disable directory browsing
6 g% P+ \& M4 Y - Options All -Indexes
; p0 ]2 F5 e Q' y" f3 _5 `$ h$ [9 ` - RewriteEngine On # 將 RewriteEngine 模式打開
. j! b. {% Q, Q: J - RewriteBase / #設定為網站的根目錄+ Q! T* I5 f9 `: h& S
- #6 e2 H" E" ~0 S0 v6 @
- RewriteCond %{HTTP_HOST} ^av4u.info [NC]' R* o* F" T) j9 M+ z2 _
- RewriteRule ^(.*)$ HTTP://www.av4u.info/$1 [L]<font face="楷體,標楷體"><font size="3">RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
* |+ J+ r! h7 T; O+ |; V N, n3 _ - RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%15 q$ a2 w, N4 X3 N! l
- RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%18 l3 ?8 V$ I5 w
- RewriteRule
8 \7 U. V S, z. C4 f9 @/ p( t& I - ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ ; i: c: a1 C! r; [$ [( D
- forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1/ E& C. H! D8 q' L/ T& i5 f) Y: N- J8 k
- RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1. o$ u0 e" G) H
- RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
+ J, g4 _' ]- ? - RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
$ j4 P; \; a8 C8 j! {1 o - RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1</font></font>
複製代碼 存檔後馬上生效
- X% |. N: b4 I& r- R( s1 [+ b ; Q; q7 A8 j) c& b
【Discuz 後台設定】 後台->全局->SEO設置->URL靜態化
- I+ ^$ U7 k2 P1 j+ j
, |8 z. w$ T ~9 m可以全選或依據網站需要勾選9 X1 g& @& a8 Q2 A* h6 Z
) V3 q. ^6 r. g8 G/ V1 ~% P1 | |