301 in HTACCESS for all Wordpress Blog URLs

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4434
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

301 in HTACCESS for all Wordpress Blog URLs

Post by simonmlewis »

Hi there

We are about to transfer someone's Weebly website to Wordpress, but their Blog is badly written in the URL. Rather than just /news or /blog, it has their company title in it, and it's causing them SEO issues.
Their blog goes back to 2011 - so using a tool to manually edit each one is a no-no.

Would a simple HTACCESS 301 like this work?

Code: Select all

RewriteRule /sitename-blog/$ /blog/? [R=301,L]
It needs to capture the main blog page, plus categories, plus the blog posts themselves.

Thanks

Simon
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply