tags:

views:

73

answers:

2

Is there a difference between php header redirect and .htaccess redirect by the SEO of the site? 10x

A: 

If the header is the same, I don't think it matters at all.

Michal M
+2  A: 

Probably not - depends how you're doing your redirection.

In PHP:

header("Location: http://www.example.com/"); /* Redirect browser, emits 302 */

If you want to emit a 301, use:

header("Location: http://www.example.com/", true, 301);

More in the PHP documentation.

If you're doing this in your .htaccess:

Redirect 302 /PATH_TO_REDIRECT http://www.example.com/

then that'll emit a 302 too.

Again, making it emit a 301 is straightforward:

Redirect 301 /PATH_TO_REDIRECT http://www.example.com/

In general, for SEO, just do what makes sense. If something's moved permanently use 301, if something's moved temporarily (e.g. during a temporary reshuffle) use 302 (take a look at the response code definitions).

Dominic Rodger