Reverse IP point to another website

Discussion in 'HOWTO-Related Questions' started by Lucrian, Jun 3, 2012.

  1. Lucrian

    Lucrian New Member

    Hello,

    I have CentOS and ISPConfig 3.
    I've configured reverse dns at my hosting to be "domain.com".

    On the server I have a domain with several sub-domains.
    The problem:
    Reverse dns at hosting is "domain.com"
    If I insert in browser "http://my.ip.address/", the browser display a sub-domain, not the domain.

    I mean, I want that "http://my.ip.address/" to go at "www.domain.com", not to "subdomain.domain.com".

    IP and (sub)domains were added through ISPConfig.

    How can I change this?

    Thanks!
     
  2. Lucrian

    Lucrian New Member

    I found the reason, but not the solution.
    For my IP: 1.1.1.1 I have 3 sites:
    domain.com
    aaa.domain.com
    ggg.domain.com

    According to Apache, default site is aaa.domain.com
    So, it's true for my server.

    The problem still remain because all virtual hosts are in folder "/etc/httpd/conf/sites-enabled" and all of them starting with 100-(sub)domain.

    I've changed 100-domain in 010-domain and was great, but I want to use ISPConfig to continue to administrate that domain.

    What can I do?
     
  3. Lucrian

    Lucrian New Member

    Well done! Maybe somebody will need the solution for this :)
    I let ISPConfig to do it's job in "/etc/httpd/conf/sites-enabled"
    I've modified httpd.conf and at the end of the file (above NameVirtualHost *:80) I wrote

    Code:
    <VirtualHost my.first.ip:80>
        RewriteEngine on
        RewriteCond %{HTTP_HOST}   ^my.first.ip$ [NC]
        RewriteRule   ^/(.*)$http://www.first.domain/$1  [R,L]
    </VirtualHost>
    
    <VirtualHost my.secondary.ip:80>
        RewriteEngine on
        RewriteCond %{HTTP_HOST}   ^my.secondary.ip$ [NC]
        RewriteRule   ^/(.*)$http://www.secondary.domain/$1  [R,L]
    </VirtualHost>
    Good luck!
     

Share This Page