[英]Old website and redirect old URL
I just upload my new website, and i would like to do some 301 redirections for the SEO. 我刚刚上传了新网站,并且希望对SEO进行一些301重定向。
My old website had URL like : http://www.myoldwebsite.com/contact/?lang=fr , http://www.myoldwebsite.com/accueil/?lang=fr , http://www.myoldwebsite.com/photos/?lang=fr 我的旧网站的网址类似: http : //www.myoldwebsite.com/contact/? lang=fr , http : //www.myoldwebsite.com/accueil/? lang = fr , http : //www.myoldwebsite.com /照片/?LANG = FR
I would like to do some redirections : 我想做一些重定向:
http://www.myoldwebsite.com/contact/?lang=fr TO http://www.myoldwebsite.com/contacts http://www.myoldwebsite.com/contact/?lang=fr 到 http://www.myoldwebsite.com/contacts
http://www.myoldwebsite.com/accueil/?lang=fr TO http://www.myoldwebsite.com/accueil http://www.myoldwebsite.com/accueil/?lang=fr 至 http://www.myoldwebsite.com/accueil
http://www.myoldwebsite.com/photos/?lang=fr TO http://www.myoldwebsite.com/gallery http://www.myoldwebsite.com/photos/?lang=fr 至 http://www.myoldwebsite.com/gallery
I made redirections like this in my .htaccess but it's impossible to combine several redirections ... 我在.htaccess中进行了这样的重定向,但是无法合并多个重定向...
RewriteCond %{REQUEST_URI} /contacts/$
RewriteCond%{REQUEST_URI} / contacts / $
RewriteCond %{QUERY_STRING} ^lang=(.*)
RewriteCond%{QUERY_STRING} ^ lang =(。*)
RewriteRule (.*) http://www.mywebsite.com/contact/ ?
RewriteRule(。*) http://www.mywebsite.com/contact/ ? [R=301,L]
[R = 301,L]
How to make it ? 怎么做?
Thanks a lot :-) Have a nice day ! 非常感谢:-)祝你有美好的一天!
http://www.htaccessredirect.net我没有尝试,但这可能对您有用。
It's easy, you should use multiple RewriteCond
conditions in your .htaccess
file: 这很容易,您应该在
.htaccess
文件中使用多个RewriteCond
条件:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^.*photos\/?
RewriteRule (.*) /gallery? [R=301,L]
RewriteCond %{REQUEST_URI} ^.*contact\/?
RewriteRule (.*) /contacts? [R=301,L]
RewriteCond %{QUERY_STRING} ^lang=(.*)
RewriteRule (.*) /$1? [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.