Regex htaccess重写规则的问题

Regex htaccess重写规则的问题,regex,apache,.htaccess,mod-rewrite,redirect,Regex,Apache,.htaccess,Mod Rewrite,Redirect,我正在为一个网站做搜索引擎优化,想更正一些谷歌网站管理员工具给出的“未找到”的url 因此,我从.htaccess文件开始这样做 http://www.chateau-de-beaugency.com/fr/index.php?id=12 应该是 http://www.chateau-de-beaugency.com/fr/infos-legales-12 http://www.chateau-de-beaugency.com/fr/acces-presse-42 http://w

我正在为一个网站做搜索引擎优化,想更正一些谷歌网站管理员工具给出的“未找到”的url

因此,我从.htaccess文件开始这样做

 http://www.chateau-de-beaugency.com/fr/index.php?id=12
应该是

 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/acces-presse-42
 http://www.chateau-de-beaugency.com/fr/nous-contacter-11
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/

应该是

 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/acces-presse-42
 http://www.chateau-de-beaugency.com/fr/nous-contacter-11
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/

应该是

 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/acces-presse-42
 http://www.chateau-de-beaugency.com/fr/nous-contacter-11
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/

应该是

 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/acces-presse-42
 http://www.chateau-de-beaugency.com/fr/nous-contacter-11
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/

应该是

 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/acces-presse-42
 http://www.chateau-de-beaugency.com/fr/nous-contacter-11
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/

应该是

 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/acces-presse-42
 http://www.chateau-de-beaugency.com/fr/nous-contacter-11
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/

应该是

 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/acces-presse-42
 http://www.chateau-de-beaugency.com/fr/nous-contacter-11
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/plan-du-site-13
 http://www.chateau-de-beaugency.com/fr/infos-legales-12
 http://www.chateau-de-beaugency.com/fr/

感谢您的帮助

您可以在
文档中使用此代码。\u ROOT/.htaccess
文件:

RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} \s/+/fr/fr/-6/les-services-35/index.php?id=12 [NC,OR]
RewriteCond %{THE_REQUEST} \s/+fr/index\.php?id=12\s [NC]
RewriteRule ^ /fr/infos-legales-12? [R=302,L]

RewriteCond %{THE_REQUEST} \s/+(fr)/index\.php?id=(42)\s [NC]
RewriteRule ^ /%1/acces-presse-%2? [R=302,L]

RewriteCond %{THE_REQUEST} \s/+(fr)/index\.php?id=(11)\s [NC]
RewriteRule ^ /%1/acces-presse-%2? [R=302,L]

RewriteCond %{THE_REQUEST} \s/+(fr)/fr/-6/les-services-35/index.php?id=13\s [NC,OR]
RewriteCond %{THE_REQUEST} \s/+(fr)/index\.php?id=13\s [NC]
RewriteRule ^ /%1/plan-du-site-13? [R=302,L]

RewriteCond %{THE_REQUEST} \s/+(fr)/chateau-de-beaugency.com/fr/\s [NC]
RewriteRule ^ /%1/? [R=302,L]

# internal forward from pretty URL to actual one
RewriteRule ^(fr)/name-([^/]+)/?$ $1/index.php?id=$2 [L,QSA,NC]

嗨,谢谢你的提示,但不幸的是它不起作用。看一看,我想要这个:转到那里:我有一条消息:“找不到请求的URL/fr/index.php在此服务器上找不到。”htaccess在我的vhost的根目录下。广告是有其他规则,我可以发送原始文件,如果你想吗?是的,它有所不同,实际上有7个不同的网址谷歌网站管理员工具告诉我是404。我猜它们是在我纠正我的重写规则(运行良好)之前被机器人程序索引的URL,所以它索引了一些重写的URL与旧URL的混合,这是由于最初对规则的错误配置。如果我清楚的话,我想我可以保留好的URL的所有规则,只需为Google工具检测到的少数(7)个坏URL添加一些硬编码的例外。它不能工作吗?我不能直接为chateau de beaugency.com/fr/index.php添加一个例外吗?id=12到chateau-de-beaugency.com/fr/infos-legales-12吗?