如何去掉win主机中wordpress链接里的index.php
有的站长在用wordpress建站时发现其博客的固定连接表现形式为: http://www.××××.com/index.php/archives/123。这样的URL对搜索引擎其实是很不友好的,非常不利于SEO。但是很多站长却不知道为什么会这样,也不知道如何解决此问题 ,其实我最早接触wp时候,也是用的win主机,后来通过慢慢的学习和研究,才发现了如何解决这个问题。
这个问题是由于虚拟主机是win2003系统的, wordpress对这个系统支持不是很好,由于编码问题而造成的链接中会有index.php。而用php开发的wordpress最合适的主机环境就是linux系统+apache运行环境,在linux环境下,去掉在wordpress固定链接中有index.php以及category 等目录链接时只需修改.htaccess文件,然后上传即可。但是win环境下就要用httpd.ini的方式了。
具体方法如下:
打开记事本,把下面代码粘贴进去:
[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]
保存时保存类型选择“所有文件”,并输入文件名称:httpd.ini
将这个httpd.ini文件上传到WP程序所在的目录也就是与index.php在同一个目录内。
之后进入WP后台修改固定链接,比如:/%category%/%post_id%.html
刷新博客首页,打开文章链接看看链接地址中的index.php是不是消失了。
WordPress博客系统设置永久链接(固定连接)参数的方法
转载文章请注明,转载自:妍熙饭 [http://www.yanxifan.com]