Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Two domains on same webspace

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Two domains on same webspace

Postby MurderX » Fri Aug 29, 2003 3:50 am

Hi, I have two domains on the same webspace and I need script for deafult page which tells to browser way to right webpages for each domain. For example:
I have webspace and there are two subdirectory:
1) /A - webpages for A
2) /B - webapges for B
and I registered two domains:
1) http://www.a.com
2) http://www.b.com
This domains use same webspace. So for the both domains is the same deafult page.
And I need script which choose a right deafult page for each domain. For example:
man write in browser http://www.a.com and script in main default page tells the browser: go to directory /A and load default page in this dir and for http://www.b.com: go to directory /B and load default page for this dir ... I hope that you understand me, because I´m not very good in english .. Thx for your tips
MurderX
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Aug 29, 2003 2:01 am

Re: Two domains on same webspace

Postby WiZARD » Fri Aug 29, 2003 4:19 am

In Apache server use VirtualHost directive
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby MurderX » Fri Aug 29, 2003 5:50 am

But I´m not a administrator of webspace ... I use webhosting
MurderX
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Aug 29, 2003 2:01 am

Postby tryton » Fri Aug 29, 2003 6:43 am

There should be documentation for this with your web hosting company. Do a search for using .htaccess on google. Here are the instructions from my web hosting company for using htaccess.
User avatar
tryton
New php-forum User
New php-forum User
 
Posts: 49
Joined: Wed Jul 09, 2003 8:25 am
Location: Joze

Postby Redcircle » Fri Aug 29, 2003 10:11 am

OR

you can slap this at the top of your index.php file

Code: Select all
switch($_SERVER['HTTP_HOST'])
{
   case 'www.a.com':
     header('Location: http://www.a.com/A/');
     break;
   case 'www.b.com':
     header('Location: http://www.b.com/B/');
     break;
}

User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby sigix » Fri Aug 29, 2003 11:29 am

your server admin (hosting comp) can do that to redirect that request to right page of domain
sigix
php-forum Active User
php-forum Active User
 
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

admin access

Postby ruturajv » Fri Aug 29, 2003 9:04 pm

you really need access to the admin level for using apache directives, else check for your web hoster
User avatar
ruturajv
php-forum Super User
php-forum Super User
 
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.