wordpress系统的伪静态规则总结:
一、.htaccess规则(常见于linux系统,apache服务器)是这样的:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
二、web.config文件(IIS7以上的伪静态规则,常见于win2008、win2012)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" /></rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
三、httpd.ini(常见于IIS6及以下)
[ISAPI_Rewrite]
# 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 /sitemap.xml /sitemap.xml [L]
RewriteRule /favicon.ico /favicon.ico [L]
# For tag(中文标签以及标签翻页的规则by 伪静态博客www.weijingtai.org)
RewriteRule /tag/(.+)$ /index.php?tag=$1
RewriteRule /tag/(.*)/page/(d+)$ /index.php?tag=$1&paged=$2
# For category(中文分类以及分类翻页的规则)
RewriteRule /category/(.*) /index.php?category_name=$1
RewriteRule /category/(.*)/page/(d+)$ /index.php?category_name=$1&paged=$2
# 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]
四、httpd.conf(西部数码的伪静态规则)
RegistrationName=Longshui Chen
RegistrationCode=7Z3NU-7MAP5-JZDPH-PR9GK
[ISAPI_Rewrite]
CacheClockRate 3600
RepeatLimit 32
#请在下面加入自己的代码例如
RewriteBase /
RewriteCond %{REQUEST_URI} !^.*.(css|js|gif|png|jpg|jpeg|xml)
RewriteRule ^(?!index.php|wp-|xmlrpc)(.*)$ /index.php [I,L]
五、Nginx伪静态规则(常见于liunx系统中)
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;
}
还没有人来评论,快来抢个沙发吧!