.Htaccess重定向index.php

时间:2014-07-26 15:05:37

标签: php apache .htaccess mod-rewrite redirect

我将旧的公告牌转移到q2a.org。现在我在google中有很多index.php文件,它们的状态为200 OK。如何将这些链接重定向到root?恩。 www.domain.com/index.php?page=Board&boardID=14或www.domain.com/index.php?page=Thread&postID=58585

这是我当前的.htaccess文件

ErrorDocument 404 /404.php
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
# Redirect non-www to www:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L] 
</IfModule>

由于

1 个答案:

答案 0 :(得分:0)

RewriteBase行之后插入此规则:

RewriteCond %{QUERY_STRING} page=[^&]+&postID=[^&]+ [NC]
RewriteRule ^ /? [R=301,L]