1

我在 .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]

我面临的问题是谷歌仍在索引旧网址,现在已经大约 1 个月了。

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

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

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

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

谢谢

4

0 回答 0