Redirect subdomain to subdomain on new domain

5,555

It would be helpful to specify how exactly is it not working. It seems to me that your code would redirect everything (including http://sio-india.org). This is because .* means "any character, zero or more repetitions", so sio-india.org would match too.

You should change your condition to

RewriteCond %{HTTP_HOST} ^(.*)\.sio-india\.org$ [NC]  
RewriteRule ^(.*)$ http://%1.sio-india.com/$1 [R=301,L]

If that doesn't fix it - please be more specific about how it doesn't work.

Share:
5,555

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin over 1 year

    I own 2 domains sio-india.org and sio-india.com

    What i want to do is redirect all the subdomains from 1st domain to 2nd domain. eg. home.sio-india.org to home.sio-india.com but i dont want to redirect sio-india.org to sio-india.com and also dont want to redirect www.sio-india.org to www.sio-india.com

    Please help

    I am using this code in htaccess but it is not working.

    RewriteCond %{HTTP_HOST} ^(.*)sio-india\.org$ [NC]  
    RewriteRule ^(.*)$ http://%1sio-india.com/$1 [R=301,L] 
    

    Please hepl me I am stuck.

    • Lauri Lehtinen
      Lauri Lehtinen almost 14 years
      Are any redirects working? I.e. is the web server set up to respect rewrites defined in .htaccess?
  • Admin
    Admin about 11 years
    Thanks it works perfecttly! I am using it on one of my sites. Was looking for a very long time.