How to redirect domain to new website

harnisa

Registered
Mar 15, 2014
1
0
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.
 

24x7server

Well-Known Member
Apr 17, 2013
1,912
99
78
India
cPanel Access Level
Root Administrator
Twitter
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
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.