中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

Discuz! X2配置偽靜態(tài)規(guī)則的詳細(xì)教程

2018-09-21    來源:愛站科技

容器云強(qiáng)勢上線!快速搭建集群,上萬Linux鏡像隨意使用

  今天小編跟大家分享一篇關(guān)于Discuz! X2配置偽靜態(tài)規(guī)則的詳細(xì)教程,感興趣的朋友跟小編一起來了解一下吧!

  URL 靜態(tài)化是一個有利于搜索引擎的設(shè)置,通過 URL 靜態(tài)化,達(dá)到原來是動態(tài)的 PHP 頁面轉(zhuǎn)換為靜態(tài)化的 HTML 頁面,可以提高搜索引擎抓取,當(dāng)然,這里的靜態(tài)化是一種假靜態(tài),目的只是提高搜索引擎的搜索量,下面主要介紹配置方法。

  分兩種情況,一種是獨(dú)立主機(jī)用戶,這部分用戶擁有對主機(jī)的管理權(quán)限,因此配置起來比較方便一些。

  首先確定您使用的 Apache 版本,及是否加載了 mod_Rewrite 模塊。

  Apache 1.x 的用戶請檢查 conf/httpd.conf 中是否存在如下兩段代碼:

  LoadModule Rewrite_module libexec/mod_Rewrite.so

  AddModule mod_Rewrite.c Apache 2.x 的用戶請檢查 conf/httpd.conf 中是否存在如下一段代碼:

  LoadModule Rewrite_module modules/mod_Rewrite.so

  如果存在,那么在配置文件(通常就是 conf/httpd.conf)中加入如下代碼。此時請務(wù)必注意,如果網(wǎng)站使用通過虛擬主機(jī)來定義,請務(wù)必加到虛擬主機(jī)配置,即 中去,如果加在虛擬主機(jī)配置外部將可能無法使用,改好后將 Apache 重啟。

  一、Apache Web Server(獨(dú)立主機(jī)用戶)

  復(fù)制代碼

  代碼如下:

  

  RewriteEngine On

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%

  3D$4&page=$3&%1

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3&%1

  

  如果沒有安裝 mod_Rewrite,您可以重新編譯 Apache,并在原有 configure 的內(nèi)容中加入 --enable-Rewrite=shared,然后再在Apache 配置文件中加入上述代碼即可。

  二、Apache Web Server(虛擬主機(jī)用戶)

  在開始以下設(shè)置之前,請首先咨詢您的空間服務(wù)商,空間是否支持 Rewrite 以及是否支持對站點(diǎn)目錄中 .htaccess 的文件解析,否則即便按照下面的方法設(shè)置好了,也無法使用。

  檢查論壇所在目錄中是否存在 .htaccess 文件,如果不存在,請手工建立此文件。Win32 系統(tǒng)下,無法直接建立 .htaccess 文件,您可以從其他系統(tǒng)中拷貝一份,編輯并修改 .htaccess 文件,添加以下內(nèi)容:

  復(fù)制代碼

  代碼如下:

  # 將 RewriteEngine 模式打開

  RewriteEngine On

  # 修改以下語句中的 /discuz 為你的論壇目錄地址,如果程序放在根目錄中,請將 /discuz 修改為 /

  RewriteBase /discuz

  # Rewrite 系統(tǒng)規(guī)則請勿修改

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1

  RewriteCond %{QUERY_STRING} ^(.*)$

  RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1

  三、IIS Web Server(獨(dú)立主機(jī)用戶)

  說明:IIS 下的 Rewrite 需要添加組件,通過篩選器的方式實(shí)現(xiàn),下面是組件的下載與配置方法:

  IIS Rewrite 下載 Rewrite.zip

  IIS Rewrite 配置

  1、將下載的 IIS Rewrite 組件解壓,放到任意盤上的任意目錄(如 C:Rewrite 下)

  2、在 IIS 管理器里選擇網(wǎng)站,右鍵選擇“屬性”,如下圖所示:

  在彈出的窗口里選擇“ISAPI篩選器”

  上圖中點(diǎn)擊“添加”,在彈出的窗口里“篩選器名稱”填寫“rewrite”

  上圖界面中點(diǎn)擊“瀏覽”,選擇下載解壓后的 IIS Rewrite 組件目錄下的 Rewrite.dll 文件

  瀏覽完畢點(diǎn)擊“確定”

  添加完畢點(diǎn)擊“確定

  重新啟動 IIS

  重新選擇該站點(diǎn) => 右鍵“屬性”=> “ISAPI 篩選器”,如果看到狀態(tài)為向上的綠色箭頭,就說明 Rewrite 模塊安裝成功了。

  這個時候返回到論壇首頁隨便打開一個版塊或者一個帖子即可看到 Discuz! 的 Rewrite 偽靜態(tài)配置成功!

  IIS Web Server(獨(dú)立主機(jī)用戶)

  復(fù)制代碼

  代碼如下:

  [ISAPI_Rewrite]

  # 3600 = 1 hour

  CacheClockRate 3600

  RepeatLimit 32

  # Protect httpd.ini and httpd.parse.errors files

  # from accessing through HTTP

  RewriteRule ^(.*)/topic-(.+)\.html(\?(.*))*$ $1/portal\.php\?mod=topic&topic=$2&$4

  RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/portal\.php\?mod=view&aid=$2&page=$3&$5

  RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$5

  RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6

  RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=group&fid=$2&page=$3&$5

  RewriteRule ^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$ $1/home\.php\?mod=space&$2=$3&$5

  RewriteRule ^(.*)/blog-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/home\.php\?mod=space&uid=$2&do=blog&id=$3&$5

  RewriteRule ^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$ $1/index\.php\?action=$2&value=$3&$5

  四、IIS7 Web Server(獨(dú)立主機(jī)用戶)

  可以將如下的配置規(guī)則加入到 web.config 中

  復(fù)制代碼

  代碼如下:

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  五、Zeus Web Server

  配置規(guī)則如下:

  復(fù)制代碼

  代碼如下:

  match URL into $ with ^(.*)/topic-(.+)\.html\?*(.*)$

  if matched then

  set URL = $1/portal.php?mod=topic&topic=$2&$3

  endif

  match URL into $ with ^(.*)/forum-(\w+)-([0-9]+)\.html\?*(.*)$

  if matched then

  set URL = $1/forum.php?mod=forumdisplay&fid=$2&page=$3&$4

  endif

  match URL into $ with ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$

  if matched then

  set URL = $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5

  endif

  match URL into $ with ^(.*)/group-([0-9]+)-([0-9]+)\.html\?*(.*)$

  if matched then

  set URL = $1/forum.php?mod=group&fid=$2&page=$3&$4

  endif

  match URL into $ with ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$

  if matched then

  set URL = $1/home.php?mod=space&$2=$3&$4

  endif

  match URL into $ with ^(.*)/(fid|tid)-([0-9]+)\.html\?*(.*)$

  if matched then

  set URL = $1/index.php?action=$2&value=$3&$4

  endif

  六、Nginx Web Server

  配置規(guī)則如下:

  復(fù)制代碼

  代碼如下:

  rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;

  rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;

  rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%

  3D$4&page=$3 last;

  rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;

  rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;

  rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;

  if (!-e $request_filename) {

  return 404;

  }

  以上就是Discuz! X2配置偽靜態(tài)規(guī)則的詳細(xì)教程,想必都了解了吧,更多相關(guān)內(nèi)容請繼續(xù)關(guān)注西部數(shù)碼技術(shù)頻道。

標(biāo)簽: isp 代碼 服務(wù)商 權(quán)限 搜索 搜索引擎 西部數(shù)碼 虛擬主機(jī) 虛擬主機(jī)配置

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:織夢會員空間調(diào)用收藏

下一篇:Discuz二次開發(fā)基本知識詳細(xì)講解