Win主机安装WordPress主页链接移除index.php

WP技巧9年前 (2016)发布 thec
2,769 00

Win主机安装Wordpress主页链接移除index.php
今日QQ群有人问为何他的wp主页链接后面会有个index.php
这大多会出现在win主机建的wp上,linux下到没怎么见到过。
解决方法

RewriteEngine On
RewriteCompatibility2 On
RepeatLimit 32
RewriteBase
#  3600 = 1 hour
# unsupported directive: CacheClockRate 3600
#  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]

把以上代码放进网站根目录(和wp-config在一个目录)的.htaccess文件里就行了,没文件就自己建立一个。

© 版权声明

相关文章