My WordPress blog has been successfully installed.
Now, I want to run the blog under a sub-domain i.e. http://blog.domain.com instead of http://host.domain.com/blog.
Let’s see how this can be done.
Initial googling points to apache and mod_rewrite. Let’s read more.
Oops, further googling shows that this can be done without using URL rewrites. Just use the built-in apache virtual hosts feature by adding the following to the config file (/etc/httpd/conf/httpd.conf in CentOS):
NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin webmaster@blog.domain.com DocumentRoot /path/to/wordpress/directory ServerName blog.domain.com ErrorLog logs/blog.domain.com-error_log CustomLog logs/blog.domain.com-access_log common </VirtualHost>
And.. voila! Not really. After doing this and restarting the apache service, http://blog.domain.com throws out a 404 error.
It turns out you need to change the WordPress working directory to the new URL via Settings>General before moving the files and implementing the virtual host. After that everything is OK.
Nak ikut cara malas, buat dalam cPanel je. Hahaha.
But first you have to install cPanel.
Edit: And I just found out it is not free.
Doesn’t your host come with it? Or are you hosting from your own box at home?
I am renting a VPS. They provide CPU, RAM, HDD, public IP address, and bandwidth. Everything else including OS installation is self-service.