i want this url http://www.vids.net/index.php?ref=somedomain.com redirect to http://www.vids.net the index page is coded in php and smarty. i have a visitor tracker in header so it must redirect before it reachs it to avoid double hits counting. i suspect this would be best done through .htaccess but also doable through php. any ideas? whoever post the best solution first will receive 20 bucks paypal. not much but enough for some motivation to respond thanks
i included the code in htaccess but still dont work Options -Indexes RewriteEngine on RewriteRule ^index.php?ref=([\S\W]*) / [L,R=301] <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>
<? if ($_GET['ref']) { Header("Location: http://www.vids.net/"); } ?> i tried this but i get the error Fatal error: Smarty error: [in smarttubedotcom-dark/header.tpl line 7]: syntax error: unrecognized tag: Header("Location: http://www.vids.net/"); (Smarty_Compiler.class.php, line 455) in /home/user/vids/vids.net/stp/admin/classes/smarty/Smarty.class.php on line 1092
Just put this before the counter: <?php header("location:http://yoursite.com/"); ?> PHP: That should work. EDIT: I saw your reply, lol. Let me think, keep refreshing. Let me see your code, PM me it.
I sent you a PM, and noticed I was wrong. Move that line of PHP to the very top of the header page. Header's cannot be after HTML.
done. but no good. {if $smarty.request.view == 'my_profile' or $smarty.request.vi i removed it cause the error was messing the page. error above was on the top of the page.
Place <?php header("location:http://www.site.com/"); ?> on the top of the page. I'm talking about the top of the whole page you are viewing, before anything else. There isn't a reason for that not to work. Thanks. EDIT; Your file extension is .php right?
hi. the code is now at the very top of the page. the output file is index.php but its decoded with ioncube so i cant view the source. templates are .tpl
Paste the following into header.tpl for testing, then try index.tpl assuming you have one ? {literal} <script type="text/javascript"> <!-- window.location = "http://www.vids.net" //--> </script> {/literal} Code (markup):
You need to have <?php header("location:xxxxxxxxxx.com"); ?> on the very very very top of the page. On top of the template, anything. As long as that's what it gets first when the page is opened. I'm sure it will work.
Thats ok it was just a test... Heres the code you need, it will only redirect if the url has a ref in it. {literal} {php} if (isset($_GET['ref'])) { echo "<script>window.location.replace(\"http://www.vids.net\")</script>"; } {/php} {/literal} Code (markup):
try this in the /public_html/.htaccess ErrorDocument 404 / RewriteEngine On RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(.*) /archive/1/$1/$2/$3/$4 RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2}) /archive/1/$1/$2/$3 RewriteRule ^([0-9]{4})/([0-9]{1,2}) /archive/1/$1/$2 Code (markup): It works for me