A
A
ansarials2018-06-17 00:01:38
WordPress
ansarials, 2018-06-17 00:01:38

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

1 answer(s)
I
Ivan Kozlov, 2018-06-17
@trampick

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();
 }

www.host.ru replace with your domain.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question