documentroot c:/xampp/wordpress options indexes followsymlinks includes execcgi allowoverride all require all granted order allow,deny allow from all
访问http://localhost:7088/和http://localhost:7088/index.php,apache的日志返回301。
::1 - - [24/jan/2016:20:53:33 +0800] get / http/1.1 301 - - mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; rv:11.0) like gecko::1 - - [24/jan/2016:20:54:08 +0800] get /index.php http/1.1 301 - - mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; rv:11.0) like gecko
但是访问http://localhost:7088/index.html和http://localhost:7088/wp-login.php都能返回200。
::1 - - [24/jan/2016:20:41:07 +0800] get /wp-login.php http/1.1 200 2713 - mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; rv:11.0) like gecko::1 - - [24/jan/2016:20:59:32 +0800] get /index.html http/1.1 200 5 - mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; rv:11.0) like gecko
我发现wordpress的siteurl只要修改为和访问地址一致的时候就会出现这个问题,如果用域名访问wordpress根目录,而siteurl是 http://localhost:7088 的时候,可以访问成功,只是wordpress的主页链接还是指向localhost。
回复内容: apache的新手,安装xampp之后,apache的端口改为7088,想装个wordpress,修改了apache的httpd.conf的根目录配置如下:
documentroot c:/xampp/wordpress options indexes followsymlinks includes execcgi allowoverride all require all granted order allow,deny allow from all
访问http://localhost:7088/和http://localhost:7088/index.php,apache的日志返回301。
::1 - - [24/jan/2016:20:53:33 +0800] get / http/1.1 301 - - mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; rv:11.0) like gecko::1 - - [24/jan/2016:20:54:08 +0800] get /index.php http/1.1 301 - - mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; rv:11.0) like gecko
但是访问http://localhost:7088/index.html和http://localhost:7088/wp-login.php都能返回200。
::1 - - [24/jan/2016:20:41:07 +0800] get /wp-login.php http/1.1 200 2713 - mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; rv:11.0) like gecko::1 - - [24/jan/2016:20:59:32 +0800] get /index.html http/1.1 200 5 - mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; rv:11.0) like gecko
我发现wordpress的siteurl只要修改为和访问地址一致的时候就会出现这个问题,如果用域名访问wordpress根目录,而siteurl是 http://localhost:7088 的时候,可以访问成功,只是wordpress的主页链接还是指向localhost。
找到解决的方法了,找到wp-content/themes/[主题名]/functions.php
在第一行增加一行
remove_filter('template_redirect', 'redirect_canonical');
你看一下你的httpd.conf的配置文件里directoryindex设置的是怎样的?