[wp-hackers] mod_rewrite help

Mike Schinkel mikeschinkel at newclarity.net
Sun Jul 19 17:44:46 UTC 2009


Matt:

Very nice! Thanks for educating me and others on this best practice.

-Mike Schinkel
WordPress Custom Plugins
http://mikeschinkel.com/custom-wordpress-plugins/




On Jul 19, 2009, at 12:17 PM, Matt Mullenweg wrote:

> 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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list