简体   繁体   中英

Bulk 301 redirect

I have +10000 links which need to be redirected in wordpress:

error page             301 redirect

example.com/page1  to  example.com/category1/page1
example.com/page2  to  example.com/category1/page2
example.com/page3  to  example.com/category1/page3
...

One category only and multiple pages. Is there a way to bulk redirect it via htaccess?

edit: I solved this with Simple 301 Redirects plugin and Bulk Uploader addon

If, as you said, there's only one category , this should work:

RewriteRule ^([a-zA-Z0-9\_\-]+) /category1/$1 [R=301,L]

Edit: I added the 301 Redirection and (L)ast flags as noticed by w3dk in the comment below. About the pattern, he's right about [a-zA-Z0-9\\_\\-]+ being (maybe) too generic. Anyway, with the details currently given by OP seems to be a good approach.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM