wordpress IIS、Nginx、Apache伪静态设置

nginx —— 在 server {} 里面添加下面的代码即可。
用宝塔的小伙伴直接在伪静态中添加 。

location / {
	try_files $uri $uri/ /index.php?$args;
}
 
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

Apache —— 新建 .htaccess 放在word press网站根目录即可

<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 —— 新建 httpd.ini 放在word press网站根目录即可

[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]

点赞
  1. 鲜活说道:
    Google Chrome Windows 10

    用的是cpanel主题 很容易搞定

    1. Dawn说道:
      Google Chrome Windows 10

      用的不是cpanel,主题是KRATOS。

发表评论

电子邮件地址不会被公开。必填项已用 * 标注