Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to redirect domain to new website

Discussion in 'General Discussion' started by harnisa, Mar 15, 2014.

  1. harnisa

    harnisa Registered

    Joined:
    Mar 15, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi,

    My old website using primary domain for example mydomain.com. I have create another new website using subdomain mydomain.com/v1

    Now I want to redirect my primary domain mydomain.com to mydomain.cm/v1 but I don't know how to do it.

    I'm not longer use the old website, should I remove the database so my primary domain can redirect to the new website?

    Kindly someone please advise me.
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,812
    Likes Received:
    84
    Trophy Points:
    78
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hello,

    Can you please try add following code in your .htaccess file.

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?YourDomain.com$
    RewriteRule ^(/)?$ blog [L]
    NOTE : change “YourDomain.com” to your domain name and blog to your sub-directory name
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,872
    Likes Received:
    1,811
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello :)

    The examples you provided show that it's the same domain name but just a different subdirectory. You could simply ensure the contents of the subdirectory replace what currently exists in the public_html directory if you want it to appear as the default content.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice