織夢偽靜態插件發布的一款一鍵開啟偽靜態插件,通過該插件可以非常方便的打開織夢偽靜態功能,且訪問路徑與PC版靜態地址一致,對SEO更加友好。
頁面內容實時更新,無需手動生成html,更加節省時間,徹底解決織夢生成靜態頁面速度慢,特別是對于文章數量多的網站,每次生成靜態HTML會非常痛苦,但不生成靜態,默認的動態地址對SEO又不友好,那么開啟偽靜態就是最好的辦法了,開啟偽靜態后,欄目及文章地址依舊與靜態化時的地址一致,但卻不用生成html,極大的節省了時間。
偽靜態插件特點:
1、偽靜態地址與真實靜態地址URL一致
2、支持PC和手機版
3、支持首頁、欄目頁、內容頁、搜索頁、TAG標簽頁的偽靜態
4、SEO優化與純靜態頁面無異
5、省去繁瑣的配置偽靜態,只需安裝此插件,一鍵實現整站偽靜態。
偽靜態插件安裝說及配置說明
1、登錄織夢后臺,找到左側菜單‘模塊’- ‘上傳新模塊’
2、點擊選擇文件上傳gbk.xml或者utf8.xml,點擊確定完成插件的上傳
3、點擊左側菜單‘模塊’- ‘模塊管理’,點擊插件名稱右邊的‘安裝’
4、安裝界面可以查看目錄是否具有寫入權限,需要寫入權限才能保證插件的正確安裝
5、‘對于已存在文件處理方法’,請選擇‘覆蓋’,點擊確定即可完成插件的安裝
6、安裝好插件后,在‘模塊’ - ‘輔助插件’ - ‘偽靜態助手’處填寫并保存配置信息
7、點擊“詳情參見”按鈕復制偽靜態代碼到指定位置
8、偽靜態成功開啟
偽靜態開啟前后對比:
偽靜態開啟前 | 偽靜態開啟后 | |
首頁 | www.xxx.com | www.xxx.com |
欄目頁 | www.xxx.com/xinwen/ | www.xxx.com/xinwen/ |
內容頁 | www.xxx.com/xinwen/2019/0324/1234.html | www.xxx.com/xinwen/2019/0324/1234.html |
搜索頁 | www.xxx.com/plus/search.php?q=關鍵詞 | www.xxx.com/search/關鍵詞.html |
TAG標簽頁 | www.xxx.com/tags.php?/TAG/ | www.xxx.com/tags/TAG.html 或 www.xxx.com/tags/TAG_ID.html |
按照以上步驟配置完后,需要將靜態規則部署到相應的服務器或者虛擬主機中:
一、如果您的主機是apache環境
請將以下偽靜態代碼拷貝至根目錄下的.htaccess文件中:
#dedecms電腦端目錄結構apache偽靜態 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} /+[^\.]+$ RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] #首頁 RewriteRule ^/$ /plus/rewrite_index\.php [L] RewriteRule ^index\.html$ /plus/rewrite_index\.php [L] RewriteRule ^index\.php$ /plus/rewrite_index\.php [L] #首頁 RewriteRule ^dede/$ /dede/index.php #TAG標簽 RewriteRule ^tags\.html$ /plus/rewrite_tags\.php RewriteRule ^tags/(.*)\.html /plus/rewrite_tags\.php\?\/$1 [L] RewriteRule ^tags/(.*)_([0-9])(?:(\?.*))\.html* /plus/rewrite_tags.php?\/$1\/$2; [L] #搜索頁 RewriteRule ^search/(.*)/([0-9]+)\.html$ /plus/rewrite_search.php?q=$1&PageNo=$2&pagesize=10&searchtype=title [L] RewriteRule ^search/(.*)\.html$ /plus/rewrite_search.php?q=$1&pagesize=10&searchtype=title [L] #列表欄目 RewriteRule ^(.*)/$ /plus/rewrite_list.php?tid=$1 [L] #列表欄目分頁 RewriteRule ^(.*)/list_([0-9]+)_([0-9]+)\.html$ /plus/rewrite_list.php?tid=$1&PageNo=$2 [L] RewriteRule ^(.*)/list_([0-9]+)\.html$ /plus/rewrite_list.php?tid=$1&PageNo=$2 [L] #文章頁 RewriteRule ^(.*)/(.*)\.html$ /plus/rewrite_view.php?aid=$1 #文章頁分頁 RewriteRule ^(.*)/([0-9]+)_([0-9]+)\.html$ /plus/rewrite_view.php?aid=$1&pageno=$2
如果需要手機端偽靜態,請將以下偽靜態代碼拷貝至/m目錄下的.htaccess文件中:
#dedecms手機目錄結構apache偽靜態 RewriteEngine On RewriteBase /m RewriteCond %{REQUEST_URI} /+[^\.]+$ RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] #首頁 RewriteRule ^$ /plus/rewrite_index\.php?mobile=1 [L] RewriteRule ^index\.html$ /plus/rewrite_index\.php?mobile=1 [L] RewriteRule ^index\.php$ /plus/rewrite_index\.php?mobile=1 [L] #TAG標簽 RewriteRule ^tags\.html$ /plus/rewrite_tags\.php?mobile=1 [L] RewriteRule ^tags/(.*)\.html /plus/rewrite_tags\.php\?\/$1&mobile=1 [L] RewriteRule ^tags/(.*)_([0-9])(?:(\?.*))\.html* /plus/rewrite_tags.php?\/$1\/$2&mobile=1 [L] #搜索頁 RewriteRule ^search/(.*)/([0-9]+)\.html$ /plus/rewrite_search.php?q=$1&PageNo=$2&pagesize=10&searchtype=title&mobile=1 [L] RewriteRule ^search/(.*)\.html$ /plus/rewrite_search.php?q=$1&pagesize=10&searchtype=title&mobile=1 [L] #列表欄目 RewriteRule ^(.*)/$ /plus/rewrite_list.php?tid=$1&mobile=1 [L] #列表欄目分頁 RewriteRule ^(.*)/list_([0-9]+)_([0-9]+)\.html$ /plus/rewrite_list.php?tid=$1&PageNo=$2&mobile=1 [L] RewriteRule ^(.*)/list_([0-9]+)\.html$ /plus/rewrite_list.php?tid=$1&PageNo=$2&mobile=1 [L] #文章頁 RewriteRule ^(.*)/(.*)\.html$ /plus/rewrite_view.php?aid=$1&mobile=1 #文章頁分頁 RewriteRule ^(.*)/([0-9]+)_([0-9]+)\.html$ /plus/rewrite_view.php?aid=$1&pageno=$2&mobile=1
二、如果您的主機是nginx環境
把大括號{}里的代碼放到你的nginx配置文件location /{}里面去。如你的環境是使用寶塔面板搭建的,請直接將下面文本框里面的代碼粘貼到站點設置中的“偽靜態”選項卡中。
location / { #手機版偽靜態規則 #首頁 rewrite ^/m/$ /plus/rewrite_index.php?mobile=1 last; rewrite ^/m/index\.html$ /plus/rewrite_index.php?mobile=1 last; rewrite ^/m/index\.php$ /plus/rewrite_index.php?mobile=1 last; #TAG標簽 rewrite ^/m/tags\.html$ /plus/rewrite_tags.php?mobile=1 last; rewrite ^/m/tags/(.*)\.html /plus/rewrite_tags.php?/$1&mobile=1 last; rewrite ^/m/tags/(.*)_([0-9])(?:(\?.*))\.html* /plus/rewrite_tags.php?/$1/$2&mobile=1 last; #搜索頁 rewrite ^/m/search/(.*)/([0-9]+)\.html$ /plus/rewrite_search.php?q=$1&PageNo=$2&pagesize=10&searchtype=title&mobile=1 last; rewrite ^/m/search/(.*)\.html$ /plus/rewrite_search.php?q=$1&pagesize=10&searchtype=title&mobile=1 last; #列表欄目 rewrite ^/m/(.*)/$ /plus/rewrite_list.php?tid=$1&mobile=1 last; #列表欄目分頁 rewrite ^/m/(.*)/list_([0-9]+)_([0-9]+)\.html$ /plus/rewrite_list.php?tid=$1&PageNo=$2&mobile=1 last; rewrite ^/m/(.*)/list_([0-9]+)\.html$ /plus/rewrite_list.php?tid=$1&PageNo=$2&mobile=1 last; #文章頁 rewrite ^/m/(.*)/(.*)\.html$ /plus/rewrite_view.php?aid=$1&mobile=1 last; #文章頁分頁 rewrite ^/m/(.*)/([0-9]+)_([0-9]+)\.html$ /plus/rewrite_view.php?aid=$1&pageno=$2&mobile=1 last; #PC版偽靜態規則 #首頁 rewrite ^/$ /plus/rewrite_index.php last; rewrite ^/index\.html$ /plus/rewrite_index.php last; rewrite ^/index\.php$ /plus/rewrite_index.php last; #后臺首頁 rewrite ^/dede/$ /dede/index.php last; #TAG標簽 rewrite ^/tags\.html$ /rewrite_tags.php; rewrite ^/tags/(.*)\.html$ /rewrite_tags.php?/$1 last; rewrite ^/tags/(.*)_([0-9])(?:(\?.*))\.html* /rewrite_tags.php?/$1/$2 last; #搜索頁 rewrite ^/search/(.*)/([0-9]+)\.html$ /plus/rewrite_search.php?q=$1&PageNo=$2&pagesize=10&searchtype=title last; rewrite ^/search/(.*)\.html$ /plus/rewrite_search.php?q=$1&pagesize=10&searchtype=title last; #列表欄目 rewrite ^(.*)/$ /plus/rewrite_list.php?tid=$1 last; #列表欄目分頁 rewrite ^(.*)/list_([0-9]+)_([0-9]+)\.html$ /plus/rewrite_list.php?tid=$1&PageNo=$2 last; rewrite ^(.*)/list_([0-9]+)\.html$ /plus/rewrite_list.php?tid=$1&PageNo=$2 last; #文章頁 rewrite ^(.*)/(.*)\.html$ /plus/rewrite_view.php?aid=$1; #文章頁分頁 rewrite ^(.*)/([0-9]+)_([0-9]+)\.html$ /plus/rewrite_view.php?aid=$1&pageno=$2; if ($request_uri !~* \.html$) { rewrite ^(.*[^/])$ $1/ permanent; } }