首页 文章

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

提问于
浏览
1

我在根目录中安装了一个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

这些网址显示正常, but the header is a 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的 Headers ,但它没有解决问题 .

我尝试将以下内容添加到根.htaccess文件(WordPress的)但它没有工作:

ErrorDocument 401 default

在根.htaccess文件(WordPress的)中,我尝试在WordPress的RewriteRules之前,之后和之内添加这些命令,但我仍然得到404标头:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/shop/(.*)$
RewriteRule ^.*$ - [L]

/ shop文件夹和子文件夹具有0755权限,文件具有0644,所有文件与WordPress安装具有相同的所有者/组 .

任何帮助表示赞赏 . 谢谢 .

1 回答

  • 0

    为了测试WP是否确实导致它:

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

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

相关问题