cancel
Showing results for 
Search instead for 
Did you mean: 

Two domains question

mar7t1n
Grafter
Posts: 84
Registered: 09-08-2007

Two domains question

I've got two domains on the Force9 DNS.
One is co-hosted on the HTML and CCGI server - bit of a mess but it works so the site has both www.mydomain1.co.uk and ccgi.mydomain1.co.uk links.
I now have a new domain supposidly pointed at the ccgi server, but not sure how to partition it. I want www.mydomain2.co.uk to point to a sub directory on the CCGI server and then everything will run below that. The two sites are totally separate.
What do I need to setup in DNS config? At the moment both URLS are running directly into my www.mydomain1.co.uk hosting. Could it by my .htaccess file on the WWW server geting in the way?
3 REPLIES
ramidoodle
Grafter
Posts: 265
Registered: 28-09-2008

Re: Two domains question

Hi,
I would use a simple redirect page, if I were you Smiley
This file needs to be in your home cgi folder as your domains are already pointing to ccgi, some modifications are required.
Quote
<html>
<head>
<title>your initial page title goes here</title>
<script language=javascript>
var whois=location+" "
if (whois.indexOf("mydomain1.co.uk") != -1)
          { window.location ="domain1folder/index.php" }
if (whois.indexOf("www.mydomain1.co.uk") != -1)
          { window.location ="domain1folder/index.php" }
if (whois.indexOf("mydomain2.co.uk") != -1)
          { window.location ="domain2folder/index.php" }
if (whois.indexOf("www.mydomain2.co.uk") != -1)
          { window.location ="domain2folder/index.php" }
</script>
</head>
<body>
</body>
</html>

Hope this helps
mar7t1n
Grafter
Posts: 84
Registered: 09-08-2007

Re: Two domains question

Just wanted to say thanks to Rami who sorted this for me.
The DNS has to be:
dukesfarm.co.uk.  a    84.92.1.5
www  cname    ccgi.force9.net.
and then you can use a .htaccess in the root of CCGI to partition domains by directory:
RewriteCond %{HTTP_HOST} ^www.dukesfarm.co.uk$ [nc]
RewriteCond %{REQUEST_URI} !^/dukesfarm/
RewriteRule (.*) /dukesfarm/$1
ramidoodle
Grafter
Posts: 265
Registered: 28-09-2008

Re: Two domains question

That looks shorter thank my Javascript!
Quote from: mar7t1n
RewriteCond %{HTTP_HOST} ^www.dukesfarm.co.uk$ [nc]
RewriteCond %{REQUEST_URI} !^/dukesfarm/
RewriteRule (.*) /dukesfarm/$1

Changing the first line to:
RewriteCond %{HTTP_HOST} ^(www\.)?dukesfarm.co.uk$ [NC]
will allow you to redirect both with and without the www
meanwhile I will stick to my javascript cause it's easier for me Wink