New domain error

Discussion in 'Site & Server Administration' started by ukmp3, Jul 31, 2005.

  1. #1
    I wanted to get some advice on the following problem as I have confused myself!


    We have an old domain with many pages

    www.DOMAIN1.co.uk

    We want to point all the old pages at www.DOMAIN2.co.uk

    At the moment we have the standard 301 php page on the index page of DOMAIN1.

    <?php
    header("HTTP/1.0 301 Moved Permanently");
    header("Location: http://www.DOMAIN2.co.uk/");

    ?>

    If I type in www.DOMAIN1.co.uk I get www.DOMAIN2.co.uk – Great




    But if I type in www.DOMAIN1.co.uk/shop/validpage.php I get a 404 error.

    The old site was on a Windows box but will be added in the morning to the same server as DOMAIN2.

    Will that sort the problem or do I need to change the htaccess file?

    Eddie
     
    ukmp3, Jul 31, 2005 IP
  2. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Do you have access to the IIS on the old box? If so, use the redirect in the IIS
     
    Corey Bryant, Jul 31, 2005 IP
  3. Neoto

    Neoto Active Member

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #3
    I'm not sure if I understanded the moving part correctly but I think you are moving the site to Apache server. If so you can configure the server so that it always serves pages from DOMAIN2. So no .htaccess changes needed. Only requirement is that the both urls point to the same server.
     
    Neoto, Jul 31, 2005 IP
  4. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Actually I just caught that both are on the same server.

    You do not need the htaccess file since you are using Windows. In IIS, right click on the domain1 and choose properties. In the Home Directory tab, choose a redirection to an URL and make it a permanent redirection. Try that and see if that is it.
     
    Corey Bryant, Jul 31, 2005 IP
  5. ukmp3

    ukmp3 Peon

    Messages:
    133
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks for all the replys

    I didn’t explain the situation as clearly as I should so here goes again

    SITE 1 ( Domain 1 ) was hosted on a Windows box. Lots of pages lots of traffic.


    We then purchased SITE 2 ( Domain 2 ) with a different hosting co on a Apache server.


    The hosting for SITE 1 has now finished and I have the following option to re-host it in an account that we use for multiply domains ( it’s like our “car park” – Windows shared box lots of space and bandwidth. If we wanted to run the entire site again we could )

    Because of this on SITE 1 we have used the above PHP script to redirect to SITE 2, and that works fine. What doesn’t work is that if any of the pages from googles index are called they get a 404 error

    Example

    www.site1.co.uk goes to www.site2.co.uk without any problems

    www.site1.co.uk/shop/anotherproduct.php goes to 404 error


    Now I can move Site 1 on to the same box as Site 2 and point it at it.

    Will that solve the problem or is there a script I can add to Site 1 Index.php to catch all pages requested for www.site1.co.uk/%%%%%%%%%%%%%%%%%

    Again the “Car park” that Site 1 is on is a SHARED windows box and can be moved

    Site 2 is on a Apache server ( shared )
     
    ukmp3, Jul 31, 2005 IP
  6. ukmp3

    ukmp3 Peon

    Messages:
    133
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    OK sorted it now - god bless 123reg.co.uk and there "catch all " web forwarding

    Many thanks

    Eddie
     
    ukmp3, Jul 31, 2005 IP
  7. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #7
    This will only work for this PHP file. Always use web server's configuration for redirects (e.g. Redirect, RedirectMatch, RewriteRule, etc).

    J.D.
     
    J.D., Jul 31, 2005 IP