Mobile app version of vmapp.org
Login or Join
Dunderdale272

: Best way to move site from subdomain to root through cPanel? I have an old Wordpress blog hosted on a subdomain (sub.mysite.com) with hundreds of posts. The root domain is actually empty and

@Dunderdale272

Posted in: #Htaccess #Redirects #Subdomain

I have an old Wordpress blog hosted on a subdomain (sub.mysite.com) with hundreds of posts.

The root domain is actually empty and redirected to the subdomain.

Now I want to move the site from the subdomain to the root domain.

I found some .htaccess examples like this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.example.com$
RewriteRule ^(.*)$ example.com/ [R=301,L]


This redirection seems to work if I clone or move the subdomain site into the root domain but, Is there an easier way? I mean, just like when you redirect from to non-www. and you only have one site installation. The site would be kept installed on subdomain folder but it would be accessed from root domain, is it possible?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Dunderdale272

1 Comments

Sorted by latest first Latest Oldest Best

 

@Bryan171

If you have mod_proxy available, you could proxy all requests forward to the subdomain through your .htaccess file with the [P] flag.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ sub.example.com/ [P]
</IfModule>


Maybe not the best way (the best way would be to move all the files and reset any links properly), but certainly the easiest.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme