win主機使用php.ini實現(xiàn)wordpress偽靜態(tài)

字號:


    使用以下方法對win空間下的wordpress設(shè)置偽靜態(tài)前,請先詢問主機商是否支持偽靜態(tài)(IIS Rewrite 組件),這個是IIS6.0下最新的wordpress偽靜態(tài)規(guī)則。
    win主機wordpress偽靜態(tài)規(guī)則:(以下涉及的代碼采自互聯(lián)網(wǎng))
    1.創(chuàng)建一個php.ini文件(創(chuàng)建一個txt文件,然后得命名為php,更改.txt的后綴為.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 /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]
    2.保存后,把php.ini文件上傳到網(wǎng)站根目錄,然后登陸wordpress博客后臺,在設(shè)置——固定鏈接中的自定義結(jié)構(gòu)設(shè)置url形式即可。
    提醒:要想使用wordpress程序建站的站長,最好還是選擇linux+apache結(jié)構(gòu)搭建的主機或用來搭配服務器環(huán)境,因為可以省下不少麻煩。