Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Nov 14 '12 at 12:45

This question came from our site for professional and enthusiast programmers.

1 Answer 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]          
...
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.