: 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
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?
More posts by @Dunderdale272
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.