I post this topic here assuming there must be some experts in php and html coding. I can set up redirection both using .php file and .html file. My concern is speed and browser compatibility (Firefox, IE), plus Norton's attempt to block a redirected url. So what should I do? Choose .php in redirecting a url or choose an .html redirection?
My preferred way, if you don't need a 'tween' page is php: header('Location: http://dest.com/'); PHP: It's what I use for my tinyurl clone i40.com -Jason
hi DopeDomains, I am using this but it seems a bit slow: <?php header("location:http://www.exampledomain.com/go/to.php"); exit; ?> Is that code correct? And I save in whatevername.php and upload it in the server. But it seems slow. What do you think?
Is that at the top of your .php file before any other processing? Check the speed of: http://i40.com/BER6Csn (It links right back to this thread via the above code). If it is slower than that, you are having a server issue.. You could, if you are always redirecting that page/site to another site, use a .htaccess page to make it even quicker. Or have your ISP adjust the apache config to make it even quicker than that. -jason
Hi Jason, I uploaded several .php files for redirecting to many urls. Examples: redirect1.php, redirect2.php, redirect3.php (about 30 of these .php files). I uploaded them to the domain folder where I installed Wordpress. I am not familiar with .htaccess and I am afraid that if I touch it I might mess up my sight.
If you weren't ever going to add new links, remove old ones, etc.. I would go for .htaccess for speed. But I think it would be a PITA to manage if you were making weekly changes.. and one mess up and all your links are down till you fix them.. Otherwise, AFAIK, <?php header('location:http://www.exampledomain.com/go/to.php'); exit; ?> PHP: Is as fast as it gets, and even with a database search first, It get's directed in under a second. If it were me, for ease of management I would go with a Db driven single php file that you can use to redirect all your pages.. (and with some fancy html, the world would never be any wiser).. Code up a simple (10 min) back end and your done. HTML redirection (at least all the ways I'm familiar with) is going to be slower.. Think about all the times you have seen "If you are not redirected automatically press here".. that is the classic HTML redirection. good luck. -Jason
Hi Jason, Thank you so much for your input. I really appreciate it. From what you have outlined here, I have come to a conclusion that a .php redirect is more practical than a .html redirection. I wish I could dump all redirection in one database but I am not a hard-core MYSQL programmer so I am doing it manually: one php file per url redirection. I just hope that Google would still index a .php file
Yes, Google treats php files just like HTML files. as for the other.. I am sure there are scripts out there, and if not $20 would get ya one. I'd set it up so links looked like: http://yoursite.com/BlogB/BestWebHostingEvah.php (or even .html) http://yoursite.com/BlogB/BestVideos.php http://yoursite.com/BlogB/NetScandles.php But they all called a single PHP file that did that header redirection, and forwarded to the site of your choice. -Jason
Hi! Bohol, If you are doing so many redirects for eg. affiliate link then I would suggest you using this technique for secure and faster process. Step 1: Sales page Create you own affiliate link codes where you have an affiliate href link such as: www.yoursite.com/redirect.php?aid=aff1 www.yoursite.com/redirect.php?aid=aff2 www.yoursite.com/redirect.php?aid=aff3 Step 2: Redirect page(redirect.php) Here put in this codes: <?PHP $aid = $_GET['aid']; if ($aid == "") {$link = "http://www.yoursite.com/";} // Default Blank if ($aid == "aff1") {$link = "http://www.affiliate1.com/?id=xxxxxxxx";} if ($aid == "aff2") {$link = "http://www.affiliate2.com/?id=xxxxxxxx";} if ($aid == "aff3") {$link = "http://www.affiliate3.com/?id=xxxxxxxx";} header("Location: $link"); // Jump to the hiddden affiliate URL above exit(); ?> With this method you not only hide your affiliate links but redirect them quick as there are no other codes on this script except redirect. Regards, Gonzo