As a consequence, I had to move several websites to a new server… You know, a nightmare changing configuration files in different CMSes…
I have faced the following problem: some of the websites were stored in subfolders (subdomains), let’s say /blog (http://www.mydomain.com/blog). After the change, we want to have the website available under the main domain http://www.mydomain.com. How to do it?
Well, the answer seems to be quite simple: copy all files to your main directory and… sadly some elements are not working. Why? It turned out that some elements references still targeted to elements in /blog. There are two solutions:
Manually change the path of each element (ex. using find&replace). But if you have thousends of files + entries in database… This may drive you crazy after a while, you can imagine. Far better solution is:
Create/modify the .htaccess file in the /blog directory:
Redirect /blog http://www.mydomain.com
That’s it The latter applies also if you want to redirect a subdomain to another web address.