hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : regional redirect script
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

regional redirect script

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 01-10-2011, 12:06 AM
lifeisjustabout lifeisjustabout is offline
Junior Guru Wannabe
 
Join Date: Dec 2010
Location: sydney
Posts: 68

regional redirect script


Hi i have scripts that redirect page for language settings thanks the guy who helped me sorted out my first problem now i am facing another problem there is a script working in www.server.com if you type only www.server.com now i created function and if you type www.server.com?redir=1 this function will not work and site will come but then my script doesnt work with ?redir=1 i think only solition have some cookie or session if someone type www.server.com?redir=1 everytime it checks and if redir ok directly goes to www.server.com without problem this problem i face because for example if you are from italy and want to see server.com you can't because server directly send you server.it all the time i put the link like www.server.com?redir=1 to disable redirect function page is okay but script not working due to address.


Code:
<?php
function redirect()
{
$Destination['en-au'] = 'http://www.server.com.au';
$Destination['pl'] = 'http://www.server.pl';
$Destination['it'] = 'http://www.server.it';

$lang = preg_replace('/;.*$/','',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$lang = preg_replace('/,.*$/','',strtolower($lang));
$dest = '';
if( isset($Destination[$lang]) ) { $dest = $Destination[$lang]; }
if( empty($dest) )
{
   $lang = substr($lang,0,2);
   if( isset($Destination[$lang]) ) { $dest = $Destination[$lang]; }
   else { $dest = $DefaultDestination; }
}
if( ! empty($dest) )
{
   header("Location: $dest");
   exit;
}
}

if (!isset($_GET['redir'])) redirect(); // if www.server.com/?redir=1 run this func. i dont want /?redir=1 something should remove this  


....
....
....
....


?>


Last edited by lifeisjustabout; 01-10-2011 at 12:10 AM.
Reply With Quote


Sponsored Links
  #2  
Old 01-10-2011, 12:17 AM
asciiDigital asciiDigital is offline
Temporarily Suspended
 
Join Date: Nov 2010
Location: Arizona
Posts: 298
We need to have a look at the apache logs to see what's going on when that page is hit. tail -f the logs while going to the page and it will tell you what is wrong.

Reply With Quote
  #3  
Old 01-10-2011, 12:38 AM
lifeisjustabout lifeisjustabout is offline
Junior Guru Wannabe
 
Join Date: Dec 2010
Location: sydney
Posts: 68
i will,
but when function is disable naturally the link still as www.server.com/?redir=1 where the problem start if i get rid of ?redir=1 after disable function it ll all good little bit tricky for me.

Reply With Quote
Sponsored Links
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Password Redirect Script Webfective Programming Discussion 0 08-10-2008 02:30 PM
Browser Redirect Script ashras99 Programming Discussion 6 08-10-2008 01:21 AM
Redirect Script cfaice Programming Discussion 12 12-22-2005 12:02 AM
Redirect script... Criminal#58369 Programming Discussion 4 09-18-2005 05:49 PM
Redirect all pages script? Johnburk Programming Discussion 11 06-23-2005 07:58 AM

Related posts from TheWhir.com
Title Type Date Posted
Pingdom Talks Top Web Hosting Cities and Countries Web Hosting News 2013-03-27 18:49:54
Whistleblower Site Cryptome Hacked, Infects PCs with Drive-By Exploits Web Hosting News 2012-02-14 14:48:24
Control Panel cPanel Launches New Apache Configuration Script Web Hosting News 2011-12-28 19:41:39
VMware Names Regional Director of Middle East North Africa Web Hosting News 2011-10-13 14:37:04
Web Host JaguarPC Adds Auto-Installer Softaculous to Hosting Plans Web Hosting News 2011-07-27 18:55:46


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?