Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
创建子文件夹,不受WordPress影响_Wordpress_Apache_.htaccess_Mod Rewrite_Http Status Code 404 - Fatal编程技术网

创建子文件夹,不受WordPress影响

创建子文件夹,不受WordPress影响,wordpress,apache,.htaccess,mod-rewrite,http-status-code-404,Wordpress,Apache,.htaccess,Mod Rewrite,Http Status Code 404,我在根目录中安装了WordPress站点。我已将在线商店添加到此网站的子文件夹/商店中。/shop文件夹中有一个index.php文件和这个.htaccess文件: #/shop/.htaccess RewriteEngine on RewriteRule ^([^/\.]+)/?$ index.php?arg1=$1 [L,QSA] RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?arg1=$1&arg2=$2 [L] 以下是一些示例有效U

我在根目录中安装了WordPress站点。我已将在线商店添加到此网站的子文件夹/商店中。/shop文件夹中有一个index.php文件和这个.htaccess文件:

#/shop/.htaccess
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ index.php?arg1=$1 [L,QSA]
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?arg1=$1&arg2=$2 [L]
以下是一些示例有效URL:

http://www.mysite.com/shop/
http://www.mysite.com/shop/clothes
http://www.mysite.com/shop/shoes
http://www.mysite.com/shop/hats
这些URL显示得很好,但是标题是404,这会导致Google出现问题

以下是请求标头:

GET /shop/clothes/ HTTP/1.1
Host: www.mysite.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://www.mysite.com/shop/
Cookie: __utma=152555369.2028364656.1389216381.1389279043.1389294490.4; __utmz=152555369.1389216381.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); wp-settings-1=editor%3Dtinymce%26hidetb%3D1%26libraryContent%3Dbrowse%26urlbutton%3Dnone%26wplink%3D1; wp-settings-time-1=1389277270; PHPSESSID=2df7073e57934fd781ab27c1c7b74245; __utmb=152555369.34.10.1389294490; __utmc=152555369; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_b2aba7eb0409bbc11fbbc4c2403dc2dc=admin%7C1389471226%7Cc07f299f80fe0ac1b15598636b08f66f
X-LogDigger-CliVer: client-firefox 2.1.7
X-LogDigger: logme=0&reqid=f7a4f2ac-3cfc-4a63-94e6-0b9233c7dfe6&
Connection: keep-alive
以下是响应标题:

HTTP/1.1 404 Not Found
Date: Thu, 09 Jan 2014 20:21:23 GMT
Server: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_perl/2.0.5 Perl/v5.8.8
X-Powered-By: PHP/5.3.13
X-Pingback: http://www.mysite.com/xmlrpc.php
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Pragma: no-cache
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
Content-Length: 14381
在我的/shop/index.php文件中,我尝试手动输出状态为200的标题,但没有解决问题

我尝试将以下内容添加到root.htaccess文件(WordPress)中,但没有成功:

ErrorDocument 401 default
在root.htaccess文件(WordPress)中,我尝试在WordPress的重写规则之前、之后和之内添加这些命令,但仍然得到404头:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/shop/(.*)$
RewriteRule ^.*$ - [L]
/shop文件夹和子文件夹拥有0755权限,文件拥有0644权限,所有文件的所有者/组与WordPress安装相同


感谢您的帮助。谢谢。

要测试WP是否确实引起了它:

  • 您可以将WP
    .htaccess
    重命名为其他名称,然后检查是否仍然获得404头

如果WP.htaccess仍然出现404错误,那么它很可能是由
/shop/
文件夹中的规则/代码引起的。

如果为了测试而将WP.htaccess重命名为其他名称,您仍然会收到404头吗?刚刚尝试过,是的,404错误在将/.htaccess重命名为/.htaccessxxxHmm后仍然出现,这意味着这不是因为WP,而是因为
/shop
中的规则/代码。你是对的。在/shop/index.php中,我删除了这两行,从而停止了404错误:
require\uuuu DIR\uuuu.'//wp blog header.php';获取_头()
但是现在页面没有标题,我需要找到另一种方式来显示它而不复制代码。谢谢你的帮助。把这个写在答案里,我会把它标为正确的。如上所述,你是对的。在/shop/index.php中,我包含了这两行代码来输出模板的标题:
require\uuuu DIR\uuuu.'//wp blog header.php';获取_头()删除它们使404错误消失(通过WP代码跟踪我知道原因)。现在页面没有标题/样式,因此我需要找到另一种显示方式。又是坦斯克。