谷歌仍然在mod_rewrite之后索引旧的URL

时间:2013-06-26 13:17:34

标签: php apache .htaccess mod-rewrite

我在.htaccess文件中包含以下内容

DirectoryIndex home.php

RewriteEngine On

RewriteRule ^profile/(.+)$ profile.php?username=$1 [NC,L]
RewriteRule ^editprofile/(.+)$ editprofile.php?username=$1 [NC,L]
RewriteRule ^designerprojects/(.+)$ designerprojects.php?username=$1 [NC,L]
RewriteRule ^favourites/(.+)$ designerfavourites.php?username=$1 [NC,L]
RewriteRule ^following/(.+)$ designerfollowing.php?username=$1 [NC,L]
RewriteRule ^followers/(.+)$ designerfollowers.php?username=$1 [NC,L]

RewriteRule ^projects/(.+)/(.+)$ projects.php?category_slug=$1&slug=$2 [NC,L]
RewriteRule ^editproject/(.+)/(.+)$ editprojects.php?category_slug=$1&slug=$2 [NC,L]

RewriteRule ^projects/(.+)$ view.php?category_slug=$1 [NC,L]
RewriteRule ^projects$ view.php [NC,L]

RewriteRule ^blog/archives/(.+)$ archives.php?archive_slug=$1 [NC,L]
RewriteRule ^blog/(.+)/(.+)$ post.php?category_name=$1&post_slug=$2 [NC,L]
RewriteRule ^blog/(.+)$ category.php?category_slug=$1 [NC,L]
RewriteRule ^blog$ blog.php [NC,L]

RewriteRule ^help/(.+)$ help.php?title_slug=$1 [NC,L]
RewriteRule ^help$ help.php [NC,L]

RewriteRule ^competitions/(.+)$ competitioninfo.php?slug=$1 [NC,L]
RewriteRule ^competitions$ competitions.php [NC,L]

ErrorDocument 404 http://www.mysite.com/404

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L,QSA]

我面临的问题是Google仍在为旧网址编制索引,现在已经过了约1个月。

阅读其他帖子我尝试将最后一行改为

RewriteRule ^(.*)$ $1.php [R=301,L,QSA]

但这会导致很多链接被破坏。

请问有人能说明我可能出错的地方吗?

谢谢

0 个答案:

没有答案