wordpress默認(rèn)的鏈接是動(dòng)態(tài)的形式,,雖然這點(diǎn)對(duì)于現(xiàn)在的搜索引擎爬蟲抓取內(nèi)容已經(jīng)不會(huì)再構(gòu)成影響了,,但是偽靜態(tài)的鏈接更具有層級(jí)結(jié)構(gòu)關(guān)系,更有利于蜘蛛抓取,。下面就說說各個(gè)web系統(tǒng)下wordpress的偽靜態(tài)規(guī)則。
apache環(huán)境下的wordpress偽靜態(tài)規(guī)則:
RewriteEngine OnRewritebase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]
新建一個(gè).htaccess文件并將以上代碼寫入.htaccess文件中,,上傳至wordpress站點(diǎn)的根目錄中,。
IIS環(huán)境下的wordpress偽靜態(tài)規(guī)則(方法一):
打開站點(diǎn)根目錄下的web.config文件并加入以下代碼:
<rewrite> <rules> <rule name="Main Rule" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:0}" /> </rule> </rules></rewrite>
IIS環(huán)境下的wordpress偽靜態(tài)規(guī)則(方法二):
新建一個(gè)httpd.ini文件并加入以下代碼:
[ISAPI_Rewrite]# Defend your computer from some worm attacks#RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]# 3600 = 1 hourCacheClockRate 3600RepeatLimit 32# Protect httpd.ini and httpd.parse.errors files# from accessing through HTTP# Rules to ensure that normal content gets throughRewriteRule ^/$ /index.php [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule /(.*) /index.php/$1 [L]
上傳至wordpress站點(diǎn)根目錄。
nginx環(huán)境下的wordpress偽靜態(tài)方法:
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段內(nèi),。
以上就是所有web環(huán)境下的wordpress偽靜態(tài)規(guī)則,。