简体   繁体   中英

Htaccess - 301 domain redirection

I want to redirect my old domain to the new one. Actually my site is under www_olddomain_pl/index.php and english version under www_olddomain_com/index_en.php

What I want to do?

olddomain_pl -> www_new_pl
www_olddomain_pl -> www_new_pl
odldomain_com -> www_new_com
www_olddomain_com -> www_new_com

And redirect from index to without index. What I actually have?

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]

I don't know what to do.

EDIT: One more: Actually I've two version of my site - polish and english. Polish version is under olddomain_pl/index.php English version is under olddomain_pl/index_en.php

I want have: Polish version under new_pl English version under new_com

So I need redirect from without www to with www and from index.php or index_en.php to without that.

You can use this rule:

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]

EDIT: As per comment:

RewriteCond %{HTTP_HOST} live-dent\.com\.pl$ [NC]
RewriteRule ^ http://www.livedent.pl%{REQUEST_URI} [R=301,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM