Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-08-2012, 01:06 PM   PM User | #1
timgolding
Senior Coder

 
timgolding's Avatar
 
Join Date: Aug 2006
Location: Southampton
Posts: 1,460
Thanks: 89
Thanked 110 Times in 109 Posts
timgolding is on a distinguished road
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.
timgolding is offline   Reply With Quote
Old 11-09-2012, 01:52 AM   PM User | #2
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
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]
Inigoesdr is offline   Reply With Quote
Users who have thanked Inigoesdr for this post:
timgolding (11-09-2012)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:32 PM.


Advertisement
Log in to turn off these ads.