hi i just modify a category link from domain.com/test/ to domain.com/demo/ all my post have now the new url domain.com/demo/post-name and now i want to redirect all 1000 links from which includes subcategoryes and post.. domain.com/test/post-name to domain.com/demo/post-name domain.com/test/post-name to domain.com/demo/post-name1 domain.com/test/post-name to domain.com/demo/post-name2 ...... domain.com/test/post-name999 to domain.com/demo/post-name999 domain.com/test/post-name1000 to domain.com/demo/post-name1000

is an easy way to make this redirect? or i have to make it one by one?

2 Answers 2


Using Apache

I'd go with an .htaccess rule

RewriteRule ^test/(.*) http://www.example.com/demo/$1 [R=301,L]

so http://www.example.com/test/page would now go to http://www.example.com/demo/page and the 301 redirect would make it permanent

make sure you put your rewrite rule after these rules

RewriteEngine on
RewriteBase /

Using Nginx

in the server block

server {
  . . .
  rewrite ^/test/(.*) http://www.example.com/demo/$1 permanent;
  . . .

Try this plugin : redirection. This will allow you to implement 301 redirect with a with a regular expression.

Also refer this thread

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.