Simple Post Redirects and Database Search
-
I have to clean my WordPress website with over 20,000 posts. By script mistake I had number of links on my website changed. Now I am trying to clean all these posts in database AND redirect (301) to original url. Also I found number of duplicated posts and was thinking to sort that issue at the same time. I could not find any plugin that sorting this in easy manner.
1. Some urls have added random numbers at the end. Always a lot of random number in two folders. For example after post url there will be: ‘1345431480000/1345720497000’ How can I find these posts (urls) in database? How can I redirect to original post?
2. other links will have ‘br/v=1/2534374302125571.htm’ added to the end. So starts with ‘br/v=1/’ and then some random numbers. Same – how can I find all this urls in database? Ans how to redirect any link ending with ‘br/v=1/2534374302125571.htm’ to original link.
3. At the same time I discovered some duplicated posts. To find them I was thinking of using query: SELECT* from wp_posts where post_name LIKE “%-2” And then delete all thsoe posts. Next to avoid 404, redirect them back to original post with:
RewriteRule ^(.*)-2 /$1 [L,R=301]
Will this ruin post that have ‘-2’ in the title? Like for the example “New Season 2012 Shoes” will be cut from ‘new-season-2012-shoes’ to ‘new-season’ ? Is there a solution to apply this only post ending with 2, 3 or 4?
I should mention that I use WP 3.3.1, WordPress SEO plugin and permalinks with mysite.com/%category%/%post_name%/
Thanks a lot for help. Just noob here trying to find his way in making WordPress websites as I love to make them. Now it time to learn how to make them better. Cheers
- The topic ‘Simple Post Redirects and Database Search’ is closed to new replies.