Multiple sites on server: The www version redirect to another domain

Hi,

I have multiple sites together on the same server,

Each domain have the DNS with a records with "@" and "www" and still when I tried to surf to the www version, like www.example.com -> I redirected to other site on the same server (usually the last one added to the server).

Why is this happening and what do I need to do, please?

Thank you

Comments

  • edited September 5

    @rebornYour DNS is fine.

    But you need to configure your webserver to recognise the "www" address.

    It sounds like you are setting up each site as <host example.com>blah blah</host> (the config. syntax will depend on which web server software you are using)

    but you don't have a match for <host www.example.com> - these are completely different sites as far as everything is concerned.

    So, the server keeps looking through it's config for a site-match, and as it doesn't find one, it just uses the last one it read in - i.e. the last site configured in the config file.


    3 ways to fix this (again, the exact command/syntax depends upon the server software):


    1) Configure a site section for www.example.com as a seperate site. You presumably don't want to do this!

    2) Add an address alias in <host example.com> .... serveralias www.example.com.....

    • this will allow both addresses to work, and exist in parallel.

    3) Create a redirect rule, "adding in" or removing the "www" bit depending on if you want www.example.com or example.com to be the main site. This means both address forms will work, but if the unpreferred form is used, it will automatically be converted to the new form. This is the best solution - for one thing it means your site won't be indexed at 2 seperate addresses.

    Anyway, the important question... What websoftware are you using?

Sign In or Register to comment.