Forum Moderators: coopster

Message Too Old, No Replies

Redirecting

html or php?

         

StoutFiles

4:21 pm on Jul 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Which method would be faster? php header redirect or html meta redirect?

jdMorgan

4:30 pm on Jul 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't know about faster, but meta-refreshes are not technically redirects, and there is no specified standard for handling them. The PHP header method will be more likely to give you joy with search engines.

Jim

[edited by: jdMorgan at 4:30 pm (utc) on July 21, 2008]

StoutFiles

4:35 pm on Jul 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm currently using the php redirect but it's just so...slow. This particular redirect page is getting around 200-300 hits a minute on a shared server.

Don't care about search engine rank for this one, in fact, I'd rather it not show up in search engines at all.

jdMorgan

4:49 pm on Jul 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's always a server-configuration redirect option as well...

If the redirect is very slow, be sure to check the redirection transaction using a server headers checker, and one that shows "all the steps." Be sure that you're not getting into some kind of rewrite/redirect loop -- a fairly common cause of "very slow" redirects.

Jim

StoutFiles

4:58 pm on Jul 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Page is real simple, just three lines. The redirect goes to an external site.

<?php
header( 'Location: http://www.example.com/new_page.php' ) ;
?>

jdMorgan

5:15 pm on Jul 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the redirect is to an external site, then the problem is not likely to be loop-related.

Do you have a general PHP performance problem on this site? There is (usually) only a small amount of time required for the server to generate and send a redirect header, for the client to process that response, and then request the new URL. After that, and ignoring the client's ISP and time-on-the-wire delays, the remaining time delay depends on the performance of the other (the redirected-to) site.

Jim

ag_47

12:04 am on Jul 22, 2008 (gmt 0)

10+ Year Member



How about using htaccess? The lower level should speed it up a bit.

janharders

8:37 am on Jul 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



as for php performance, if you're running in php-cgi (as opposed to mod_php), several hundred requests on a script will make it slow.

try .htaccess, like
redirect permanent http://www.example.com/new_page.php
or
redirect temporary http://www.example.com/new_page.php
if you want it to be a temporary redirect