本帖最後由 IT_man 於 2014-12-25 11:19 編輯
7 {+ v0 W- b6 Y' N! q& U7 ~
; D: H, u% J: N! S: [在此分為「Host server設定」及「Discuz 後台設定」
! z- \$ q7 D$ A, ]% N8 u【Host server設定】 又分為Web server及站台根目錄下的.htaccess/ S* ^7 Z6 z9 A" G
Web server 註:有個地方須注意,/etc/httpd/conf/httpd.conf中<Directory "/www/coav4u/test"> 的 AllowOverride 一定要all,.htaccess才有作用 @ b# M9 a( K# ?% ^
9 P: u- d0 p& b* n2 x1 ~1 }
站台根目錄下的.htaccess- # -FrontPage-
. `1 j; C; Z q2 V. R - IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* v; N$ Y- a6 o& J- v
- # disable directory browsing
, `; u2 y' f9 f) u - Options All -Indexes
0 W: h! x* E- z+ B$ S$ U \) B - RewriteEngine On # 將 RewriteEngine 模式打開
* ~: p4 p5 c+ c; T" I0 | - RewriteBase / #設定為網站的根目錄" _* C% I" J+ [9 a& P4 |
- #
, o' |' w7 N. k) h* `' u; U, l( C - RewriteCond %{HTTP_HOST} ^av4u.info [NC]/ J9 @9 f9 W. {- J/ i0 v0 x5 `
- RewriteRule ^(.*)$ HTTP://www.av4u.info/$1 [L]<font face="楷體,標楷體"><font size="3">RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1$ W0 J- K: l, _
- RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
, ?% v8 o5 n2 x% d+ B7 |4 Y - RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1% e5 S" M$ M: {1 M2 R/ u
- RewriteRule
( T% L6 D0 S% a. t - ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$
$ R: B' \7 X; B" q4 q - forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
& ?7 _' n, J5 R& ^! b% ?- o+ ` - RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
1 A6 Z3 H6 ?3 E+ D' H - RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
5 U, c1 u! w5 ~. s3 X) h - RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
; v; l! f' V5 O( C0 v - RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1</font></font>
複製代碼 存檔後馬上生效
7 U W: ~" |$ _" Z ( z7 N$ w) S$ E6 |7 j! g2 f4 V
【Discuz 後台設定】 後台->全局->SEO設置->URL靜態化
# H% F7 r" g$ w$ A% y
+ o5 \' N9 {7 X" o( @$ d' B, @
可以全選或依據網站需要勾選
( v1 M& w2 p2 p' }& ~) _" e3 Y
* ~% W& w. T' b |
|