htaccess 301 redirect Vs php script in Wordpress
I want to modify all the old URLs to a recently migrated WP site. The modification logic is a bit complex, so I'm thinking of a using some PHP script to do the conditional regexp_replace in the URL.
The questions are :
- Is this a bad strategy compared to htaccess 301 redirect, from SEO and efficiency standpoint?
- Where would I add this (regexp replace code) in the in开发者_如何转开发dex.php of WP?
As long as the old page returns a 301 in the head along with the distinction of where the page lives now it doesn't really matter which way you generate your 301 response.
If you just rename all the old pages you will lose all you SEO of those pages.
Re point 1, it depends on the number of rules. Consider that, with an htaccess-based solution, the redirect rules are applied irrespective of whether they're needed or not.
Re point 2, there are redirect plugins for that:
http://www.google.com/search?q=site:wordpress.org/extend/plugins+redirect
精彩评论