去掉win主机下wordpress伪静态的/index.php/

WordPress教程 5328

一般情况下,wordpress博客系统使用windows系统的服务器主机设置的固定链接的结构中,会多出/index.php/部分,如https://www.boke8.net/index.php/1.html形式,这样结构的URL无论是在美观或SEO方面都让人感觉到不友好,不过可以通过简单的方法去掉index.php。

wordpress去掉index.php的方法步骤:

  1. 使用文本工具创建一个命名为httpd,后缀为.ini格式的文件(即httpd.ini文件)
  2. 编辑httpd.ini文件,在其中添加以下代码:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    [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 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]
  3. 保存文件后,上传到wordpress程序根目录
  4. 然后登陆博客后台,重新设置固定链接即可。

PS:使用wordpress程序还是推荐使用Linux系统的主机

精品推荐: