Jump to content

2 Domains, 1 Site, load different index files


DSchragg

Recommended Posts

Hello Everyone, this is my first post on this great and very useful site.

 

I'm hoping someone can give me a quick and simple answer for this one.....

 

Here's my scenario:

 

I have 2 domain names that point to one website. One domain is english the other french. I want an index.php file to handle what index file is loaded.

If the user types in french.com I want it to load the index_french.html file, if the user types english.com I want the site to load index.html

 

Sounds simple enough, but I may be wrong?

 

Thanks in advance for your help.

Link to comment
Share on other sites

This would be much better off being handled via mod_rewrite not php.

 

Something like:

 

RewriteCond  Host:  (?:www\.)?french\.com
RewriteRule  (.*)   french_index.php?p=$1 [i,L]

RewriteCond  Host:  (?:www\.)?english\.com
RewriteRule  (.*)   english_index.php?p=$1 [i,L]

Link to comment
Share on other sites

This would be much better off being handled via mod_rewrite not php.

 

Something like:

 

RewriteCond  Host:  (?:www\.)?french\.com
RewriteRule  (.*)   french_index.php?p=$1 [i,L]

RewriteCond  Host:  (?:www\.)?english\.com
RewriteRule  (.*)   english_index.php?p=$1 [i,L]

 

Wow, that was quick, thanks for your help.

I'm going to try this now and report back......

Link to comment
Share on other sites

Ok so I edited my .htaccess file, and this did not work...maybe host?

 

This did work however:

 

if($_SERVER['SERVER_NAME'] == 'french.mysite.com'){
header('Location: http://french.mysite.com/index_french.html');
}

 

Thanks for your help!

Link to comment
Share on other sites

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.