Jump to content

Can this be done? Help please


kirkzeus

Recommended Posts

Hi all

 

I am after some advice here.

 

I have some space on a web server which belongs to one domain name, but also this space has a second domain name pointing to it. Under the web hosting plan I have, I can only have one index page, e.g. index.php, which would therefore be used for both domain names, but I want to have completely separate web pages for each of these 2 domain names.

 

Is there any way, ideally using PHP, that I can identify which one of these two domain names a visitor has come to and thereby displaying an index page which is specific for that domain name?

 

e.g.

if a visitor came to my web space using www.site1.com they would go to index1.php

if a visitor came to my web space using www.site2.com they would go to index2.php

 

Many thanks

Link to comment
https://forums.phpfreaks.com/topic/82706-can-this-be-done-help-please/
Share on other sites

There should be a folder for each domain, and I think your web host means you can only have 1 index.php per site, which makes sense because anytime you try and upload another index.php it will just overwrite the old one.

 

I have 2 sites running on one account and the configuration is as follows:

 

Location:public_html/ (main site)

index.php

/folder/

/domain2/ (second site)

 

I simply just put in the index I want for domain2 in the domain2 folder

 

Location: /public_html/domain2/

index.php

otherfile.php

image.png

 

Get it? You can only have 1 index per folder.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.