- 工信部備案號 滇ICP備05000110號-1
- 滇公安備案 滇53010302000111
- 增值電信業務經營許可證 B1.B2-20181647、滇B1.B2-20190004
- 云南互聯網協會理事單位
- 安全聯盟認證網站身份V標記
- 域名注冊服務機構許可:滇D3-20230001
- 代理域名注冊服務機構:新網數碼
wordpress默認的鏈接是動態的形式,大家都喜歡搞搞SEO,變換下鏈接地址,于是wordpress偽靜態就登場了。偽靜態的鏈接更具有層級結構關系,更有利于蜘蛛抓取,不同的web環境偽靜態鏈接規則也不一樣,整理了幾種,方便大家參考。 apache環境下的wordpress偽靜態規則
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
新建一個.htaccess文件并將以上代碼寫入.htaccess文件中,上傳至wordpress站點的根目錄中。 IIS環境下的wordpress偽靜態規則 方法1、打開站點根目錄下的web.config文件并加入以下代碼:
<rulename="Main Rule"stopProcessing="true"> <matchurl=".*"/> <conditionslogicalGrouping="MatchAll"> <addinput="{REQUEST_FILENAME}"matchType="IsFile"negate="true"/> <addinput="{REQUEST_FILENAME}"matchType="IsDirectory"negate="true"/> <actiontype="Rewrite"url="index.php/{R:0}"/>
方法2、新建一個httpd.ini文件并加入以下代碼:
[ISAPI_Rewrite] # Defend your computer from some worm attacks #RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 # Protect httpd.ini and httpd.parse.errors files # from accessing through HTTP # Rules to ensure that normal content gets through RewriteRule /tag/(.*) /index\.php\?tag=$1 RewriteRule /software-files/(.*) /software-files/$1 [L] RewriteRule /images/(.*) /images/$1 [L] RewriteRule /sitemap.xml /sitemap.xml [L] RewriteRule /sitemap.xml.gz /sitemap.xml.gz [L] RewriteRule /robots.txt /robots.txt [L] RewriteRule /favicon.ico /favicon.ico [L] # For file-based wordpress content (i.e. theme), admin, etc. RewriteRule /wp-(.*) /wp-$1 [L] # For normal wordpress content, via index.php RewriteRule ^/$ /index.php [L] RewriteRule /(.*) /index.php/$1 [L]
上傳至wordpress站點根目錄。
nginx環境下的wordpress偽靜態方法
location / { index index.html index.php; if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php; } }
將以上代碼加入到nginx.conf文件的Server段內。 這是目前比較流行的幾種web配置的偽靜態規則。
售前咨詢
售后咨詢
備案咨詢
二維碼
TOP