[wp-hackers] mod_rewrite help

Matt Mullenweg m at mullenweg.com
Sun Jul 19 16:17:54 UTC 2009


On 7/18/2009 10:29 PM, Mike Schinkel wrote:
> Oops, that one line should have been ($path, not $$path):
>
>    header('Location:' . $url_paths[$path],true,301);

For extra points, use wp_redirect:

http://codex.wordpress.org/Function_Reference/wp_redirect

It works on IIS and Apache, and also with different PHP setups that a 
regular header() call won't.

It's also more secure, the URLs are sanitized and run through KSES to 
disallow header splitting attacks.

See also:

http://codex.wordpress.org/Data_Validation#HTTP_Headers

http://en.wikipedia.org/wiki/HTTP_response_splitting

-- 
Matt Mullenweg
http://ma.tt | http://wordpress.org | http://automattic.com


More information about the wp-hackers mailing list