Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 修改后的谷歌仍在为旧网址编制索引_Php_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Php 修改后的谷歌仍在为旧网址编制索引

Php 修改后的谷歌仍在为旧网址编制索引,php,apache,.htaccess,mod-rewrite,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?user

我已在.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]
我面临的问题是,谷歌仍然在为旧的URL编制索引,现在已经有大约一个月了

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

RewriteRule ^(.*)$ $1.php [R=301,L,QSA]
但这导致我的很多链接被破坏

有人能告诉我哪里出了问题吗


谢谢

您希望URL重定向到新的URL。当你说链接被破坏时,他们是重定向不当还是抛出了服务器错误?仅仅因为已经一个月了,并不意味着谷歌已经在那个时间段内重新访问了该网站。查看google缓存的
版本,并检查
这是页面的快照,因为它出现在…
@dethron5000-对不起,是的,我应该更清楚,因为R=301他们重定向不正确。例如,当测试时,指向“我的术语”页面的链接应该是,但当您单击某个链接时,该链接将转到(我刚刚通过转到尝试了此操作,效果很好)。(这是关于修改robots.txt文件中的R=301部分,这样谷歌就不会为你不想被索引的文件编制索引了?你也可以使用网站管理员工具请求重新编制网站索引。