Apache的新手,安装XAMPP之后,apache的端口改为7088,想装个wordpress,修改了apache的httpd.conf的根目录配置如下:
<code>DocumentRoot "C:/xampp/wordpress" <directory> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted Order allow,deny Allow from all </directory></code>
访问http://localhost:7088/和http://localhost:7088/index.php,apache的日志返回301。
<code>::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"</code>
但是访问http://localhost:7088/index.html和http://localhost:7088/wp-login.php都能返回200。
<code>::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"</code>
我发现wordpress的siteURL只要修改为和访问地址一致的时候就会出现这个问题,如果用域名访问wordpress根目录,而siteurl是 http://localhost:7088 的时候,可以访问成功,只是wordpress的主页链接还是指向localhost。
Apache的新手,安装XAMPP之后,apache的端口改为7088,想装个wordpress,修改了apache的httpd.conf的根目录配置如下:
<code>DocumentRoot "C:/xampp/wordpress" <directory> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted Order allow,deny Allow from all </directory></code>
访问http://localhost:7088/和http://localhost:7088/index.php,apache的日志返回301。
<code>::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"</code>
但是访问http://localhost:7088/index.html和http://localhost:7088/wp-login.php都能返回200。
<code>::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"</code>
我发现wordpress的siteURL只要修改为和访问地址一致的时候就会出现这个问题,如果用域名访问wordpress根目录,而siteurl是 http://localhost:7088 的时候,可以访问成功,只是wordpress的主页链接还是指向localhost。
找到解决的方法了,找到wp-content/themes/[主题名]/functions.php
在第一行增加一行
<code>remove_filter('template_redirect', 'redirect_canonical');</code>
你看一下你的httpd.conf的配置文件里DirectoryIndex设置的是怎样的?