我想将我的旧域名重定向到新域名。实际上我的网站在www_olddomain_pl/索引下.php英文版本在www_olddomain_com/index_en.php
我想做什么?
olddomain_pl -> www_new_pl
www_olddomain_pl -> www_new_pl
odldomain_com -> www_new_com
www_olddomain_com -> www_new_com
并从索引重定向到没有索引。我到底有什么?
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)olddomain_pl(.*) [NC]
RewriteRule ^(.*)$ http://www_olddomain_pl/$1 [R=301,L]
RewriteRule ^index.php$ http://www_new_pl/ [R=301,L]
RewriteCond %{HTTP_HOST} ^(.*)olddomain_com(.*) [NC]
RewriteRule ^(.*)$ http://www_new_com/$1 [R=301,L]
我不知道该怎么办。
编辑:再来一个:实际上,我的网站有两个版本 - 波兰语和英语。波兰语版本在olddomain_pl/索引下.php英文版在olddomain_pl/index_en.php
我想要:波兰语版本在new_pl英文版在new_com
所以我需要从没有 www 重定向到 www 和从索引.php或index_en.php重定向到没有那个。
您可以使用此规则:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}'s/+index_en'.php [NC]
RewriteRule ^ http://www.live-dent.com/ [R=301,L,NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}'s/+index'.php [NC]
RewriteRule ^ / [R=301,L,NC]
RewriteCond %{HTTP_HOST} live-dent'.pl$ [NC]
RewriteRule ^ http://www.livedent.pl%{REQUEST_URI} [R=301,L]
编辑:根据评论:
RewriteCond %{HTTP_HOST} live-dent'.com'.pl$ [NC]
RewriteRule ^ http://www.livedent.pl%{REQUEST_URI} [R=301,L]