I have a category archive page at: http://mysite.com/news
It displays an archive of items from the category ‘news-article’
I’d like to redirect any requests for http://mysite.com/category/news-article to http://mysite.com/news (so that the former is never directly accessible).
Is there a best practice? Should I put a 301 Redirect in my .htaccess file (or use a plugin to do the same)?
Or should I use wp_safe_redirect
? If yes, which action hook should I use? As in:
add_action( 'WHICH_ACTION_HOOK??', 'adam_redirect_news' );
function adam_redirect_news () {
if ( is_category( 'news-article' ) ) {
wp_safe_redirect( 'http://mysite.com/news' );
exit;
}
}