I want www1.domain.com to say blog.domain.com, & I've tried everything I can think of

Discussion in 'Apache' started by aucyris, Aug 1, 2008.

  1. #1
    *Note: Changed Domain and IPs to generic*
    *Note: Bounced Apache after every conf edit*

    I have a DNS A Record entry for www1.domain..com that points to 10.1.1.1

    I have a DNS CNAME entry for blog.domain.com that points to www1.domain.com

    In the httpd.conf file for www1, I have a Virtual Host entry that reads as follows:

    <VirtualHost blog.domain.com>
    ServerAdmin it@domain.com
    DocumentRoot /var/www/html
    ServerName blog.domain.com
    ServerAlias blog.domain.com blog
    ErrorLog logs/blog.domain.com-error_log
    CustomLog logs/blog.domain.com-access_log common
    </VirtualHost>

    However, when I go http://blog.domain.com, it shows as http://www1.domain.com

    I created a separate .conf file (blog.conf) in /etc/httpd/conf.d:

    <VirtualHost *:80>
    ServerAdmin it@domain.com
    DocumentRoot /var/www/html
    ServerName blog.domain.com
    ServerAlias blog.domain.com blog
    ErrorLog logs/blog.domain.com-error_log
    CustomLog logs/blog.domain.com-access_log common
    </VirtualHost>

    I’ve tried using Apache ReWrite, which I'm not very familiar with, but that sends it into an endless loop:

    RewriteEngine on

    RewriteRule ^/blog/(.*) /$1 [L,R]

    RewriteCond %{HTTP_HOST} !^blog\.domain\.com [NC]
    RewriteCond %{HTTP_HOST} !^$
    RewriteRule ^/(.*) http://blog.domain.com/$1 [L,R]

    This jumps it back and forth between blog and www1.

    ---Other settings on httpd.conf include---:
    #Listen 12.34.56.78:80
    Listen 80

    #ServerName www.example.com:80
    #ServerName www1.domain.com:80
    #Created and commented this out as it should read from virtual hosts first.

    #NameVirtualHost blog:80
    #Created and commented this out as it had no effect.
    ------

    Any ideas? If not, can you point me to someone that may be able to assist?
     
    aucyris, Aug 1, 2008 IP
  2. wwwhoster

    wwwhoster Peon

    Messages:
    11
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if you are using cpanel its really simple !

    just go in ur whm and create an account with domain www1.domain.com thats it!
     
    wwwhoster, Aug 4, 2008 IP
  3. aucyris

    aucyris Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Unfortunately, I'm not using cPanel.
    I set this server up from scratch.

    However, I did discover something interesting.

    http://blog.domain.com/test.txt does not change the domain, so that's good.
    However, http://blog.domain.com/index.php does.

    I'm going to look at the code on that page, but it may be how it processes php.
     
    aucyris, Aug 4, 2008 IP
  4. aucyris

    aucyris Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It was something in the php code.
    I apologize for the post.
     
    aucyris, Aug 4, 2008 IP