-1

First of all, am new to doing back-end server admin.. I have a main website being served on at certain IP. I have a blog address that lives on another IP, which was used on wordpress.com. When a user typed in blog.domain.com it would resolve to the Wordpress.com site. Since coming on board (two months) they wanted me to bring the blog in house. So, I set up a wordpress install at domain.com/blog.

I would like blog.domain.com (different ip) to resolve to domain.com/blog but still using blog.domain.com is this possible with Apache and mod_rewrite?

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296

1 Answers1

1

Easiest option would be to alter the DNS record for:

blog.domain.com, such that it points to the same IP address as: domain.com, you could simply make it a CNAME for the latter.

Then Either:

1) Enable name based VirtualHosts in Apache and set-up a new Apache Virtualhost section for blog.domain.com, there's a section detailing this on the Apache site, and set it's document root to be the Wordpress /blog/ root.

2) If name based virtual hosting is already enabled alternatively add blog.domain.com as a ServerAlias within the existing domain.com virtualhost, along with the following rule:

<VirtualHost *:80>
    ServerName  domain.com
    ServerAlias blog.domain.com

    RewriteEnging On
    RewriteCond %{HTTP_HOST} blog.domain.com   [NC]
    RewriteRule ^$  /blog/  [L]          
...
arober11
  • 417
  • 3
  • 6