ibby Banned Banned 1,661 2010 688 0 Mar 10, 2012 #1 Hello can someone please help me out redirecting by using Javascript? not for my site, but would like to create a script. I Would like Site.com/index.php?something=* TO site.com/ Thanks!
Hello can someone please help me out redirecting by using Javascript? not for my site, but would like to create a script. I Would like Site.com/index.php?something=* TO site.com/ Thanks!
BlaZe Active Member Veteran 3,985 2009 767 505 Mar 10, 2012 #2 You're trying to track clicks or something ?
D Desi_Boy Active Member 356 2012 68 0 Mar 10, 2012 #3 http://www.tizag.com/javascriptT/javascriptredirect.php
S soft2050 Active Member 2,942 2010 438 0 Mar 10, 2012 #5 ^ Exactly, htaccess would do it more efficiently Anyway, add this php code in the document and it will work (code is untested but should work) PHP: <?php if (isset($_GET['something'])) { $baseurl = 'http://' . $_SERVER['HTTP_HOST']; echo '<script language="javascript" type="text/javascript">window.location.href="' . $baseurl . '";</script>'; } ?>
^ Exactly, htaccess would do it more efficiently Anyway, add this php code in the document and it will work (code is untested but should work) PHP: <?php if (isset($_GET['something'])) { $baseurl = 'http://' . $_SERVER['HTTP_HOST']; echo '<script language="javascript" type="text/javascript">window.location.href="' . $baseurl . '";</script>'; } ?>
L Lock Down Active Member 2,122 2010 228 0 Mar 10, 2012 #7 If headers in his code weren't already sent...