腾讯云服务器优惠活动华纳云香港服务器

Win主机如何设置WordPress网站伪静态?

WordPress主题推荐

Win+IIS 环境的 WordPress 网站,可以选择 Rewite 规则来实现伪静态。具体方法如下:

1、咨询空间商,服务器是否已开启 Rewrite 规则的支持。

2、新增 httpd.ini 文件,写入以下代码,并拷贝至网站根目录。

  1. [ISAPI_Rewrite]
  2. # 3600 = 1 hour
  3. CacheClockRate 3600
  4. RepeatLimit 32
  5. # Protect httpd.ini and httpd.parse.errors files
  6. # from accessing through HTTP
  7. # wordpress weijingtai
  8. # For tag
  9. RewriteRule /tag/(.*)/page/(\d+)$ /index\.php\?tag=$1&paged=$2
  10. RewriteRule /tag/(.+)$ /index\.php\?tag=$1
  11. # For category
  12. RewriteRule /category/(.*)/page/(\d+)$ /index\.php\?category_name=$1&paged=$2
  13. RewriteRule /category/(.*) /index\.php\?category_name=$1
  14. # For sitemapxml
  15. RewriteRule /sitemap.xml /sitemap.xml [L]
  16. RewriteRule /favicon.ico /favicon.ico [L]
  17. # For file-based wordpress content (i.e. theme), admin, etc.
  18. RewriteRule /wp-(.*) /wp-$1 [L]
  19. # For normal wordpress content, via index.php
  20. RewriteRule ^/$ /index.php [L]
  21. RewriteRule /(.*) /index.php/$1 [L]
  22. # For robots.txt
  23. RewriteRule /robots.txt /robots.txt [L]

3、到 WordPress 后台修改固定链接为 %post_id%.html 即可,当然也可以是其他的。

以上内容整理自@张戈博客

本文地址:https://boke112.com/post/4438.html

赞 (0) 打赏
版权声明:本文为原创文章,版权归 boke112百科 所有,欢迎分享本文,转载请保留出处!发布此文是出于传递更多信息之目的,若有来源标注错误或侵犯了您的合法权益,请联系我们,确认后马上更正或删除,谢谢!
香港云主机55元/年
wu