Answer the question
In order to leave comments, you need to log in
301 mass wordpress redirect when changing permalinks?
Hello, please tell me how to make a mass redirect when changing permalinks in WP. Previously, permalinks were of such an arbitrary type /%category%/%postname%.html
, now I want them to be of this type /%category%/%postname%/
, since some plugins do not work with the old type of permalinks. I would really appreciate an answer, thanks a lot.
Answer the question
In order to leave comments, you need to log in
Make a backup of the site with the database just in case. Then just change the look of the permalinks. If the wp redirect itself will not do, then use, for example, such a script
$h = $_SERVER['REQUEST_URI'];
if (strpos($h,'.html') > 0) {
$h = str_replace('.html','',$h);
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.host.ru".$h);
exit();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question