Fernando Souza
Fernando Souza

Reputation: 1779

Redirect old domain to new domain using .htaccess

Its really basic but I cant make it work. How can I redirect an old domain to a new domain, and also redirect certain pages from the old domain, to new urls from the new domain?

Redirect 1 http://www.oldsite.com https://newsite.com/

Redirect 2 http://www.oldsite.com/about/ https://newsite.com/this/

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^http://www.shion-kaikan.com$ [NC]
RewriteRule ^(.*)$ https://shion.com/ [R=301,L]

Upvotes: 0

Views: 47

Answers (1)

Amit Verma
Amit Verma

Reputation: 41209

You can not match against URL scheme or path in %{HTTP_HOST} . You can only match against your domain name ie . example.com or www.example.com .

The following should work.

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.shion-kaikan.com$ [NC]
RewriteRule ^(.*)$ https://shion.com/ [R=301,L]

Upvotes: 1

Related Questions