Redirecting sub-domain to sub-directory
Recently I moved the EWEA blog from the sub-domain into the sub-directory of the EWEA website.
Before: http://blog.ewea.org/
After: http://www.ewea.org/blog/
To handle the redirect I put in the following into /etc/httpd/conf.d/vhosts.conf
<VirtualHost *:80> # EWEA BLOG ServerName blog.ewea.org Redirect 301 / http://www.ewea.org/blog/ RedirectMatch 301 /(.+) http://www.ewea.org/blog/$1 ErrorLog logs/blog.ewea.org-error_log CustomLog logs/blog.ewea.org-access_log common </VirtualHost>
The Redirect clause redirects all the traffic from the sub-domain to the sub-directory.
The RedirectMatch is to remap existing URLs to the sub-directory to avoid broken links.
(Taken from http://stackoverflow.com/questions/9397089/redirect-blog-mydomain-com)
