discuz x3.2的SEO設定
本帖最後由 IT_man 於 2014-12-25 11:19 編輯在此分為「Host server設定」及「Discuz 後台設定」
【Host server設定】 又分為Web server及站台根目錄下的.htaccess
Web server
[*]檢查web server是否啟動 rewrite 模組 以Apache(其他如Nginx道理相同,只是方法不同)為例,開啟/etc/httpd/conf/httpd.conf找到是否有這行LoadModule rewrite_module modules/mod_rewrite.so,有才可繼續下列動作
[*]加入Rewrite設定 於/etc/httpd/conf/httpd.conf加入你的網站目錄段如下:<Directory "/www/coav4u/test">
RewriteEngine On# 將 RewriteEngine 模式打開
RewriteBase / #設定為網站的根目錄
RewriteCond %{HTTP_HOST} ^av4u.info
RewriteRule ^(.*)$ HTTP://www.av4u.info/$1
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
RewriteRule ^article-(+)-(+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteRule ^forum-(\w+)-(+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteRule ^thread-(+)-(+)-(+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteRule ^group-(+)-(+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
RewriteRule ^blog-(+)-(+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteRule ^archiver/(fid|tid)-(+)\.html$ archiver/index.php?action=$1&value=$2&%1
Options Includes FollowSymLinks
AllowOverride All
Allow from all
Order allow,deny
addDefaultCharset UTF-8
</Directory>
[*]存檔後重啟httpd : service httpd restart 才會生效
註:有個地方須注意,/etc/httpd/conf/httpd.conf中<Directory "/www/coav4u/test"> 的 AllowOverride 一定要all,.htaccess才有作用
站台根目錄下的.htaccess# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
# disable directory browsing
Options All -Indexes
RewriteEngine On # 將 RewriteEngine 模式打開
RewriteBase / #設定為網站的根目錄
#
RewriteCond %{HTTP_HOST} ^av4u.info
RewriteRule ^(.*)$ HTTP://www.av4u.info/$1 <font face="楷體,標楷體"><font size="3">RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
RewriteRule ^article-(+)-(+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteRule ^forum-(\w+)-(+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteRule
^thread-(+)-(+)-(+)\.html$
forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteRule ^group-(+)-(+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
RewriteRule ^blog-(+)-(+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteRule ^archiver/(fid|tid)-(+)\.html$ archiver/index.php?action=$1&value=$2&%1</font></font>存檔後馬上生效
【Discuz 後台設定】 後台->全局->SEO設置->URL靜態化
可以全選或依據網站需要勾選
頁:
[1]