日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

discuz 生成静态html,Discuz论坛静态化设置方法

發(fā)布時(shí)間:2025/4/5 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 discuz 生成静态html,Discuz论坛静态化设置方法 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

URL靜態(tài)化可以提高搜索引擎抓取,Discuz論壇程序是如何實(shí)現(xiàn)URL靜態(tài)化的呢?

為給大家提供發(fā)布問題、解決問題、分享經(jīng)驗(yàn)的平臺(tái),本站現(xiàn)已開啟經(jīng)驗(yàn)交流區(qū)(基于Discuz論壇程序)。

剛使用Discuz程序搭建交流區(qū)的時(shí)候碰到了幾個(gè)問題,不過通過百度一下均都得以解決。特開啟Discuz欄目為DZ建站者們分享Discuz常見問題及解決方案,希望經(jīng)驗(yàn)分享為你所用!

Discuz論壇程序如何開啟URL靜態(tài)化?

登錄Discuz后臺(tái),Rewrite設(shè)置方法:全局——>SEO設(shè)置——>URL 靜態(tài)化

discuz論壇URL靜態(tài)化

如上圖,勾選需要URL靜態(tài)化的頁面,然后點(diǎn)擊右上角的“查看當(dāng)前的 Rewrite 規(guī)則URL 靜態(tài)化”鏈接。可以看到Discuz已經(jīng)為我們生成了Rewrite規(guī)則,如下所示:

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

RewriteEngine?On

RewriteCond?%{QUERY_STRING}?^(.*)$

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

RewriteCond?%{QUERY_STRING}?^(.*)$

RewriteRule?^(.*)/article-([0-9]+)-([0-9]+)\.html$?$1/portal.php?mod=view&aid=$2&page=$3&%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?^(.*)/(fid|tid)-([0-9]+)\.html$?$1/archiver/index.php?action=$2&value=$3&%1

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

#?將?RewriteEngine?模式打開

RewriteEngine?On

#?修改以下語句中的?/discuz?為您的論壇目錄地址,如果程序放在根目錄中,請(qǐng)將?/discuz?修改為?/

RewriteBase?/discuz

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

RewriteCond?%{QUERY_STRING}?^(.*)$

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

RewriteCond?%{QUERY_STRING}?^(.*)$

RewriteRule?^article-([0-9]+)-([0-9]+)\.html$?portal.php?mod=view&aid=$1&page=$2&%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?^(fid|tid)-([0-9]+)\.html$?archiver/index.php?action=$1&value=$2&%1

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

[ISAPI_Rewrite]

#?3600=1hour

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?^(.*)/(fid|tid)-([0-9]+)\.html(\?(.*))*$?$1/archiver/index\.php\?action=$2&value=$3&$5

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

Zeus Web Server

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

if?matched?then

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

endif

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

if?matched?then

set?URL=?$1/portal.php?mod=view&aid=$2&page=$3&$4

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?^(.*)/(fid|tid)-([0-9]+)\.html\?*(.*)$

if?matched?then

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

endif

Nginx Web Server

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

rewrite?^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$?$1/portal.php?mod=view&aid=$2&page=$3?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?^([^\.]*)/(fid|tid)-([0-9]+)\.html$?$1/archiver/index.php?action=$2&value=$3?last;

if?(!-e?$request_filename)?{

return?404;

}

重要說明:

以上規(guī)則是根據(jù)上圖中勾選的頁面后自動(dòng)生成的。根據(jù)自己的服務(wù)器類型選擇對(duì)應(yīng)的規(guī)則,比如 久久經(jīng)驗(yàn)網(wǎng) 的服務(wù)器是Apache,那就不能選IIS Web Server。

如果discuz論壇程序是建立在根目錄,就將對(duì)應(yīng)的Rewrite規(guī)則粘貼到.htaccess文件里通過FTP上傳到根目錄;如果discuz論壇程序是在網(wǎng)站里擴(kuò)展出來的,比如:根目錄/bbs,則將此.htaccess文件存放在bbs目錄下。久久經(jīng)驗(yàn)網(wǎng)的經(jīng)驗(yàn)交流區(qū)采取的就是這種方式。

以上規(guī)則都設(shè)置好后重新更新緩存,刷新前臺(tái)界面discuz論壇的板塊鏈接就變成靜態(tài)的了,如:本站經(jīng)驗(yàn)交流區(qū)的Web技術(shù)分區(qū)下的Web前端板塊https://www.exp99.com/bbs/forum-2-1.html。

總結(jié)

以上是生活随笔為你收集整理的discuz 生成静态html,Discuz论坛静态化设置方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。