Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.