Current location: Hot Scripts Forums » Programming Languages » PHP » Domain Redirect.


Domain Redirect.

Reply
  #1 (permalink)  
Old 06-27-07, 10:12 AM
Hunter Hunter is offline
Newbie Coder
 
Join Date: Dec 2005
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Domain Redirect.

Hey. What im going to ask, I know it could be done by .htaccess or whatever but I wondered if it can be done in PHP.

I have a .com/.co.uk/.net/.org.. When the .co.uk or .net for example is visisted. I want the splash page I have to redirect them to the .com..

Like, if domain .co.uk redirect to .com

I know like I said this could be done by .htaccess or through cPanel.

Regards,
Hunter
Reply With Quote
  #2 (permalink)  
Old 06-27-07, 10:44 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Give this a try:

PHP Code:

if (preg_match('/\.(co\.uk|net)$/'$_SERVER['SERVER_NAME']))
{
    
header('Location: http://www.example.com/');
    exit();

Reply With Quote
  #3 (permalink)  
Old 06-27-07, 01:04 PM
Hunter Hunter is offline
Newbie Coder
 
Join Date: Dec 2005
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
That works great, thanks very much.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
php redirect script, same path different domain corman420 PHP 2 03-06-07 10:39 AM
New Year 2007 Promotions: We are almost 7 years old! mxhub General Advertisements 0 01-12-07 01:15 PM
Pre-christmas special sales - 12 exclusive coupons! Limited stocks! mxhub General Advertisements 0 12-07-06 08:47 PM
Myhomehost.com |Web Hosting & Domain Solutions | Egold & Credit Cards Accepted extreme90 General Advertisements 0 07-19-06 04:09 PM
redirect domain aprogrammer PHP 1 02-28-06 03:59 AM


All times are GMT -5. The time now is 06:06 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.