You are here:  » parked domains


parked domains

Submitted by paullas on Tue, 2020-12-01 09:18 in

Hi David

I have just posted about show different products from parked domains, but also would it be possible to show a url so for example if i park a toys domain at example.com it points to a custom file like this https://www.example.com/toys.php

thanks

Paul

Submitted by support on Wed, 2020-12-02 08:44

Hi Paul,

I just replied regarding parked domains, and you can use exactly the same technique to include a PHP file - simply add to your index.php:

<?php
  
switch($_SERVER["HTTP_HOST"])
  {
    case 
"example.net":
      require(
"toys.php");
      break;
    case 
"example.org":
      require(
"something_else.php");
      break;
    default:
      require(
"default.php"); // show default home page content, separated out into default.php file
      
break;
  }
?>

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Thu, 2020-12-03 16:40

Hi David

I have added the following to my index.php:

{code saved}

any ideas if i have done anything wrong.

thanks

Paul

Submitted by paullas on Thu, 2020-12-03 16:48

Hi David

I have removed the code from the index.php as it was stopping the site loading.

below is my index.php with the coded added, does this look right to you:

{code saved}

Submitted by support on Fri, 2020-12-04 08:19

Hi Paul,

It looks like you added the code right at the top of the script, in fact sorry it needs to go within the main body (somewhere between header/footer includes) and also no need for the PHP tags - just insert before the following line;

  require("html/footer.php");

...so you'd have something like;

  switch($_SERVER["HTTP_HOST"])
  {
    case "example.net":
      require("toys.php");
      break;
    case "example.org":
      require("something_else.php");
      break;
    default:
      require("default.php"); // show default home page content, separated out into default.php file
      break;
  }
  require("html/footer.php");

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Fri, 2020-12-04 09:35

Hi David

I have tried the above and below is my index.php file

the domain securenames.uk should be showing the toys.php file but still showing the main front page:

{code saved}

Submitted by support on Fri, 2020-12-04 10:28

Hi Paul,

Ah, I see your toys.php is a complete page not just a content module to be included so in that case the code does need to go at the top, and exit() after the require statements.

Keep the code inside the opening PHP tag, so where you have at line 2:

  require("includes/common.php");

...REPLACE with:

  switch($_SERVER["HTTP_HOST"])
  {
    case "example.net":
      require("toys.php");
      exit();
      break;
    case "example.org":
      require("something_else.php");
      exit();
      break;
  }
  require("includes/common.php");

(no default: case required now as the code will just fall through into your main home page...)

Cheers,
David.
--
PriceTapestry.com

Submitted by paullas on Fri, 2020-12-11 21:07

Hi David.

I have been thinking about the above.

Would it be possible to use something like if i have example.com and i park example.org on the website then on the home page of example.com it displays content from a file called example.php.

I know you have sent me code years ago to use an include file but for the life of me i cannot find it.

thanks

Paul

Submitted by support on Mon, 2020-12-14 08:19

Hi Paul,

That should be exactly what the previous mod would do - just make sure that example.php is complete home page, e.g. start with a copy of index.php and then customise it for the parked domain. At the top of the main index.php the replacement would be e.g.

  switch($_SERVER["HTTP_HOST"])
  {
    case "example.org":
      require("example.php");
      exit();
      break;
  }
  require("includes/common.php");

Cheers,
David.
--
PriceTapestry.com