我网站上的无限重定向循环,但为什么呢?

时间:2013-11-01 19:58:50

标签: php .htaccess mod-rewrite redirect

我的某些页面的链接检查器中有404,我可以在浏览器中正常打开,当我检查这些页面时,我还会在Google网站管理员工具中收到无限循环警告,而我找不到源代码问题!

以下是整个故事:我有两个网站,w1和w2。过了一会儿,我决定将w2的内容移到w1的子目录中。所以,现在我在W1的根目录中有一个CMS,子目录中有另一个CMS(第一个CMS是TextPattern,第二个是OpenCart)。我已将旧的w2网站重定向到w1中的特定子目录。

旧w2中的htaccess包含:

Redirect 301 / w2/subdirectory?oldlink=

(?oldlink =可能看起来很愚蠢,但我不知道这样做有多好!)

w1根目录中的htaccess:

DirectoryIndex index.php index.html

Options +FollowSymLinks
Options -Indexes
ErrorDocument 403 default

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.+) - [PT,L]

    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^(.*) index.php

    RewriteCond %{HTTP:Authorization}  !^$
    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>

#php_value register_globals 0

# SVG
AddType image/svg+xml  svg svgz
AddEncoding gzip       svgz

最后,子文件夹中的htaccess(在w1内部,对于旧w2的内容):

Options +FollowSymlinks

# Prevent Directoy listing 
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On

RewriteBase /subdirectory/
RewriteRule sitemap.xml /index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

我的网页中没有任何重定向标签。 在子目录中一切正常;我可以打开页面,浏览它们等等。

当我在在线链接检查器中检查w1时,我在子目录中获得404页面。当我用Fetch as Google检查它时,它给了我“该页面似乎重定向到自己。这可能会导致无限重定向循环。请查看有关重定向的帮助中心文章。“警告,以下详细信息如下:

HTTP/1.1 301 Moved Permanently
Date: Sun, 27 Oct 2013 16:42:24 GMT
Server: LiteSpeed
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Location: the sub directory
X-Powered-By: PleskLin
Content-Type: text/html
Content-Length: 413

<html>
<head><title> 301 Moved Permanently
</title></head>
<body><h1> 301 Moved Permanently
</h1>
The document has been permanently moved to <A HREF="%s">here</A>.<hr />
Powered By <a href='http://www.litespeedtech.com'>LiteSpeed Web Server</a><br />
<font face="Verdana, Arial, Helvetica" size=-1>LiteSpeed Technologies is not responsible for administration and contents of this web site!</font></body></html>

所以,我真的很困惑。我找不到无限重定向的来源。谁能帮我这个? 感谢。

0 个答案:

没有答案