wordpress伪静态(包含nginx子目录伪静态)

nginx子目录伪静态 wordpress是目录名
location /wordpress {
        try_files $uri $uri/ /wordpress/index.php?$args;
}

location ~ \.php$ {
        fastcgi_split_path_info ^(/wordpress)(/.*)$;
}



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>


IIS伪静态
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 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]


IIS7伪静态
<rule name="re1" stopProcessing="true">
<match url="^sitemap.xml" ignoreCase="false" />
<action type="Rewrite" url="sitemap.xml" />
</rule>
<rule name="re2" stopProcessing="true">
<match url="^favicon.ico" ignoreCase="false" />
<action type="Rewrite" url="favicon.ico" />
</rule>
<rule name="re3" stopProcessing="true">
<match url="^wp-(.*)" ignoreCase="false" />
<action type="Rewrite" url="wp-{R:1}" />
</rule>
<rule name="re4" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="index.php" />
</rule>
<rule name="re5" stopProcessing="true">
<match url="^(.*)" ignoreCase="false" />
<action type="Rewrite" url="index.php/{R:1}" />
</rule>

nginx设置伪静态
location / {
  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;
      }
 }

	
About sun 83 Articles
85后青年,自诩为伪文艺青年

Be the first to comment

Leave a Reply

Your email address will not be published.


*