[英]issue with htaccess RewriteRule
I'm working on SEO for a website and wanted to correct some "not-found" url given by Google Webmasters tools. 我正在为网站进行SEO,并想更正Google网站站长工具提供的一些“未找到” URL。
So I started on the .htaccess file to do so. 因此,我开始在.htaccess文件中进行操作。
http://www.chateau-de-beaugency.com/fr/index.php?id=12
should be 应该
http://www.chateau-de-beaugency.com/fr/infos-legales-12
and 和
http://www.chateau-de-beaugency.com/fr/index.php?id=42
should be 应该
http://www.chateau-de-beaugency.com/fr/acces-presse-42
and 和
http://www.chateau-de-beaugency.com/fr/index.php?id=11
should be 应该
http://www.chateau-de-beaugency.com/fr/nous-contacter-11
and 和
http://www.chateau-de-beaugency.com/fr/index.php?id=13
should be 应该
http://www.chateau-de-beaugency.com/fr/plan-du-site-13
and 和
http://www.chateau-de-beaugency.com/fr/fr/-6/les-services-35/index.php?id=13
should be 应该
http://www.chateau-de-beaugency.com/fr/plan-du-site-13
and 和
http://www.chateau-de-beaugency.com/fr/fr/-6/les-services-35/index.php?id=12
should be 应该
http://www.chateau-de-beaugency.com/fr/infos-legales-12
and 和
http://www.chateau-de-beaugency.com/fr/chateau-de-beaugency.com/fr/
should be 应该
http://www.chateau-de-beaugency.com/fr/
Thank you for your help 谢谢您的帮助
You can use this code in your DOCUMENT_ROOT/.htaccess
file: 您可以在
DOCUMENT_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]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.