Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts

    Wrong site given through https

    This post on a different forum best describes my problem.

    http://forums.cpanel.net/f5/wrong-si...tps-21927.html

    google is indexing my https:// sites as the wrong site. I need to stop https on other sites on the same IP going to the secure site.

    I already put

    PHP Code:
    if(!in_array($_SERVER["SERVER_NAME"], array("192.168.1.99""www.domain1.com","domain1.com","secure.domain1.com")))
    {    
        
    header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
        echo 
    "<h1>404 Not Found</h1>";
        exit;

    at the top of the secure site which should 404 redirect any other domain for the time being. But how do i do this with apache. I have 5 IPs set up on the server i can use. But not sure how to configure. Or is there another way. Or can i do something clever with mod_rewrite
    You can not say you know how to do something, until you can teach it to someone else.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Not tested, but you can try something like this:
    Code:
    RewriteEngine on
    RewriteCond %{HTTPS} on
    Rewritecond %{HTTP_HOST} !^www\.securedomain\.com
    RewriteRule ^ - [L,R=404]

  • Users who have thanked Inigoesdr for this post:

    timgolding (11-09-2012)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •