ansarials2018-06-17 00:01:38
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)
Ivan Kozlov, 2018-06-17

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

 if (strpos($h,'.html') > 0) {
  $h = str_replace('.html','',$h);
  header("HTTP/1.1 301 Moved Permanently"); 
  header("Location: http://www.host.ru".$h); 

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