WordPress偽靜態(tài)設(shè)置規(guī)則,301重定向設(shè)置方法(win主機)
本站空間為win主機,關(guān)于偽靜態(tài)和301重定向問題,研究了好長時間終于好了?,F(xiàn)在共享給win主機的同學(xué)。
win主機偽靜態(tài)和301重定向都需要用到httpd.ini文件,上傳到網(wǎng)站根目錄。
(有httpd.ini文件的修改,沒有的直接新建)
先上完整代碼:
[ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 RewriteCond Host: ^yhaow.com$ RewriteRule (.*) http://blog.yhaow.com$1 [R,I] # Protect httpd.ini and httpd.parse.errors files # from accessing through HTTP # wordpress # For tag RewriteRule /tag/(.*)/page/(d+)$ /index.php?tag=$1&paged=$2 RewriteRule /tag/(.+)$ /index.php?tag=$1 # For category RewriteRule /category/(.*)/page/(d+)$ /index.php?category_name=$1&paged=$2 RewriteRule /category/(.*) /index.php?category_name=$1 # For sitemapxml RewriteRule /sitemap.xml /sitemap.xml [L] RewriteRule /sitemap.html /sitemap.html [L] RewriteRule /sitemap_baidu.xml /sitemap_baidu.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]
WP偽靜態(tài)說明:
需要在wordpress后臺 設(shè)置→固定連接→自定義為 /%category%/%postname%.html
[toggle title=”固定連接參數(shù)”]%year%:基于文章發(fā)布的年份;
%monthnum%:基于文章發(fā)布的月份;
%day%:基于文章發(fā)布當(dāng)日;
%hour%:基于文章發(fā)布小時數(shù);
%minute%:基于文章發(fā)布分鐘數(shù);
%second%:基于文章發(fā)布秒數(shù);
%postname%:基于文章的postname,其值為撰寫時指定的縮略名,不指定縮略名時是文章標(biāo)題;
%post_id%:基于文章post_id;
%category%:基于文章分類,子分類會處理成“分類/子分類”這種形式;
%author%:基于文章作者名。[/toggle]
[toggle title=”網(wǎng)上常見的幾種設(shè)置方法”]/%year%/%monthnum%/%day%/%postname%/
/%year%/%monthnum%/%postname%/
/%year%/%monthnum%/%day%/%postname%.html
/%year%/%monthnum%/%postname%.html
/%category%/%postname%.html
/%post_id%.html
本站采用/%post_id%.html格式,個人覺得簡單[/toggle]
301重定向說明:
以本站為例:需要把ainiseo.com重定向到m.fpfocvy.com.cn 代碼如下:
RewriteCond Host: ^ainiseo.com$ RewriteRule (.*) http://m.fpfocvy.com.cn$1 [R,I] 以上代碼,請根據(jù)你的網(wǎng)站自行修改。
免責(zé)聲明:網(wǎng)所有文字、圖片、視頻、音頻等資料均來自互聯(lián)網(wǎng),不代表本站贊同其觀點,內(nèi)容僅提供用戶參考,若因此產(chǎn)生任何糾紛,本站概不負責(zé),如有侵權(quán)聯(lián)系本站刪除!郵箱:207985384@qq.com http://m.fpfocvy.com.cn/jianzhan/955.html