I have my website and WordPress installed on a Linode server running Ubuntu. The directories are: ~/public_html - Website ~/public_blog - WordPress installation
My DNS and site config is set up so that: hashbang0.com - Points to website in ~/public_html blog.hashbang0.com - Points to WordPress install in ~/public_blog
Site config as follows:
<VirtualHost 123.456.789.000:80>
ServerAdmin user@gmail.com
ServerName hashbang0.com
ServerAlias www.hashbang0.com
DocumentRoot /home/user/public_html/
ErrorLog /home/user/log/error.log
CustomLog /home/user/log/access.log combined
</VirtualHost>
<VirtualHost 123.456.789.000:80>
ServerAdmin user@gmail.com
ServerName blog.user.com
ServerAlias blog.user.com
DocumentRoot /home/user/public_blog/
ErrorLog /home/hashbang0/log/blog_error.log
CustomLog /home/hashbang0/log/blog_access.log combined
</VirtualHost>
Now, I have had enough of tinkering with PHP, HTML, etc. I want to move my WordPress installation so that visitors to hashbang0.com see the WordPress site. At the same time, anyone with links to the old blog.hashbang0.com (most notably RSS feeds and a few links spattered about which gain a fair amount of traffic, etc.) shouldn't be cut off (possibly be redirected to the appropriate thing on hashbang0.com).
I guess I could possibly change the site config to:
<VirtualHost 123.456.789.000:80>
ServerAdmin user@gmail.com
ServerName hashbang0.com
ServerAlias www.hashbang0.com
DocumentRoot /home/user/public_blog/
ErrorLog /home/user/log/error.log
CustomLog /home/user/log/access.log combined
</VirtualHost>
And I guess I'd need to update the URL in Settings > General?
I don't want to start moving stuff and find I've shot myself in the foot. The WordPress howtos are great, but riddled with if this and if that...
Any help would be very much appreciated.
Ben
Ben,
Your best bet is to litterally move the entire blog folder over to your public folder. In this case, you will want to write a redirect htaccess script on the blog subdomain.
RewriteCond %{HTTP_HOST} ^blog\.mydomain\.com$ [NC]
RewriteRule ^(.*) http://www.mydomain.com/$1 [L,R]
In a Command Line Interface, CLI,
You would cp -r ~/public_blog ~/public_html
make sure to make back ups! And when you are all done, create the .htaccess file in ~/public_blog and delete the old files.
You may want to look into adding a 301 Redirect so google knows you moved also.