0

I recently changed my website and copied all contents from old domain to new domain. The old domain I had was a subdomain on a free webhost and Now I want to redirect all pages this to new.

My goal

http://old.domain.com/anything ==> http://newdomain.com


How can I do it in htaccess? I have already tried with redirect but just the homepage is redirect. Help is appriciated. Thanks

marla
  • 3
  • 1
  • possible duplicate of [.htaccess redirect all pages to new domain](http://stackoverflow.com/questions/1945568/htaccess-redirect-all-pages-to-new-domain) – Richard Erickson Apr 27 '15 at 02:47

2 Answers2

0
 # This will redirect a subdomain to another domain
 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^old\.domain\.com$ [NC]
 RewriteRule ^(.*) http://newdomain.com/$1 [L,R]
Pedro Lobito
  • 85,689
  • 29
  • 230
  • 253
0

You can try this in your Root/.htaccess

 RedirectMatch 301 ^/(.*)/?$ http://www.newdomain.com/$1
Amit Verma
  • 39,545
  • 18
  • 87
  • 107