52AV手機A片王|52AV.one

 找回密碼
 立即註冊
查看: 1276|回復: 0

[Discuz X3.2] Apache環境設定偽靜態(rewrite)之SEO

[複製鏈接]
發表於 2016-8-14 11:43:25 | 顯示全部樓層 |閱讀模式
tid=45014& 本帖最後由 IT_man 於 2016-8-14 21:30 編輯
% Z  p2 W) F, [6 L# X; I
4 n* y$ g; ?% V方法有二:1 @% H1 i- P( j; S, _
方法一〗使用.htaccess/ |% q+ p( g  ]/ P1 j; ^
1.開啟網站根目錄之.htaccess(例如/home/test/public_html). i. O$ j3 _) c' c% u
  1. RewriteEngine On
    ( v& g( e' O& J  A& y/ |1 B
  2. RewriteBase /
      y" J0 H% L0 |' ~3 A8 n. C. M

  3. ( c* R: r9 l! H/ m) Z/ S8 I$ F
  4. RewriteCond %{QUERY_STRING} ^(.*)$/ k3 }1 P! l( e6 c- P
  5. RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topicid=$1&%11 I8 K+ B) c9 E( l) K# Y: e7 R
  6. RewriteCond %{QUERY_STRING} ^(.*)$
    / D4 D. n* I" y, |
  7. RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1( `! Z9 K: |. g+ O% G4 {# ~
  8. RewriteCond %{QUERY_STRING} ^(.*)$0 y2 j- u1 n9 G! t, c
  9. RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
    8 {4 `5 T+ N7 L) o  C. Z1 k; ?
  10. RewriteCond %{QUERY_STRING} ^(.*)$! J/ W5 z: n$ M2 u/ E
  11. RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1; [& N4 T9 ~- b- }! l0 f
  12. RewriteCond %{QUERY_STRING} ^(.*)$, M8 Q9 t% h6 |9 z2 M7 E' L
  13. RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1% v3 N1 Y- T0 F# l8 _* d, }& Q
  14. RewriteCond %{QUERY_STRING} ^(.*)$  L. U5 @( o; B; Y& J* C; f
  15. RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
    : y4 k" [* F. z/ {( V/ N9 k+ O
  16. RewriteCond %{QUERY_STRING} ^(.*)$
    " d1 n2 N+ E2 M+ Y0 ?5 x
  17. RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%19 c: l* Z* L$ N1 \, z
  18. RewriteCond %{QUERY_STRING} ^(.*)$
      _4 Q9 K9 q: N) m. P" Y& b
  19. RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1' @( l' R" L+ h, K' R0 z  @4 Y
複製代碼
2.Discuz3.2論壇後台->全局->SEO設置->URL靜態化->勾選所有靜態化 , 立即生效
6 V; Y' D2 n2 W1 q/ w5 V) h" g方法二〗使用Apache的rewrite(mod_rewrite)設定  j, S3 U/ w0 R
1.在/etc/httpd/conf/httpd.conf內之<VirtualHost *:80>內的<Directory "/home/domain/public_html">內,或
0 ]: _- K9 f# A. ^1 e. z& K5 R- t在/etc/httpd/conf.d/虛擬主機設定檔如virtual.conf內之<VirtualHost *:80>內的<Directory "/home/domain/public_html">內
/ }0 q' H0 A; F) J* j5 Y8 {( `增加以下內容:9 Z) j. }- x8 S; r# V% w4 d

$ a8 z" c& C: a& k" _
  1.     RewriteEngine On2 j1 Y- o  v0 }4 r- M8 R; Y
  2.     RewriteCond %{QUERY_STRING} ^(.*)$
    & |/ ?: j' C) r# a
  3.     RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topicid=$1&%1
    " C1 z9 m: T$ I) U7 }$ z, g8 ~9 i0 u
  4.     RewriteCond %{QUERY_STRING} ^(.*)$
    ! P1 s8 D) o$ G6 r# }3 Q' w5 D1 i
  5.     RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
    * X% c6 c! B8 w, I. o5 k
  6.     RewriteCond %{QUERY_STRING} ^(.*)$; ?4 k, f# J$ c
  7.     RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1- {. _3 X$ a9 K+ g! [6 H" t
  8.     RewriteCond %{QUERY_STRING} ^(.*)$9 N, g. W  y! ~% N: h* y( E
  9.     RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%16 U, Z1 B1 U' H/ B
  10.     RewriteCond %{QUERY_STRING} ^(.*)$4 |* J; X" H3 q/ d/ A
  11.     RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
    * ?8 U: r, D- l$ y( Q$ O2 j# c" h
  12.     RewriteCond %{QUERY_STRING} ^(.*)$
    ) d+ H! q. O; l/ u
  13.     RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1" r, q; Y2 W# f/ j) X% F3 P% x
  14.     RewriteCond %{QUERY_STRING} ^(.*)$+ ~- \+ X& }/ Z+ c+ J, K
  15.     RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1- p) E7 ]( ~0 j3 K4 @
  16.     RewriteCond %{QUERY_STRING} ^(.*)$
    & S, W$ `  u7 R& Z; ?( x
  17.     RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
    : q) Z" e# W+ U- ^
複製代碼
2.在/etc/httpd/conf/httpd.conf內需有# }$ ]8 c+ X8 E# a4 X; }
LoadModule rewrite_module modules/mod_rewrite.so   這一行
$ S0 t" u  t; g然後重啟 httpd ==>  service httpd restart3 ^6 w9 D( r' ]( J8 w
7 r$ f" [1 b% B% @/ P  q4 w: Y

% _  H! |. V% D: ~
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則



中文酷站排行榜

本區塊內容依據『電腦網路內容分級處理辦法』為限制級網站,限定年滿18歲以上或達當地國家法定年齡人士方可進入,且願接受本站各項條款,未滿18歲 謝絕進入瀏覽。為防範未滿18歲之未成年網友瀏覽網路上限制級內容的圖文資訊,建議您可進行網路內容分級組織ICRA分級服務的安裝與設定。 (為還給愛護 本站的網友一個純淨的論壇環境,本站設有管理員)

QQ|小黑屋|手機板| 52AV手機A片王

GMT+8, 2024-12-25 14:44 , Processed in 0.068881 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回復 返回頂部 返回列表