What's FASTER method to redirect a specific (specific) page, a PHP or htaccess? Thinking about that lots of different pages may require such redirect on the high traffic site. e.g. what's faster:

PHP (no database queries involved, just simple plain php redirect)

header("Location: /new.php",TRUE,301)



redirect 301 old.php http://site.com/new.php

.htacess are processed before php is known as, if you can make it, it'll surely be faster

If htaccess can be used whatsoever, Apache will process it before any PHP processing starts. I've not done the benchmarks on using either, however when both of them are present, htaccess will be faster.

Also observe that htaccess redirect could be written using regex to use to multiple old files, so less focus on your finish.

Is dependent. Generally, .htaccess is going to be faster since you will not possess the overhead of invoking PHP. However -- if you have 1000 redirects in one .htaccess file in the document root level, then Apache will have to check each of them on every page load. I.e., rather than just serving index.php, you are now going to need to do 1000 regex inspections, and then serve index.php. Overall, I'd state that if you have lots of redirects and lots of pages that will not be rerouted, then get it done in PHP. Within this situation, you do not pay any other overhead for that pages that don't have to be rerouted.