Critter
Critter

Reputation: 462

Regex for .htaccess to change urls

I have urls from a joomla install that are coming in like:

http://blah.com/blog/543-this-is-the-blog-title

I need to change them for wordpress to:

http://blah.com/this-is-the-blog-title

I know it can be easily done using regex in the .htaccess file.

Upvotes: 0

Views: 29

Answers (1)

anubhava
anubhava

Reputation: 785058

Yes it can be done easily.

Put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteRule ^blog/[0-9]+-(.+)$ /$1 [L,NC,R=301]

Make sure this is the first rule in your DOCUMENT_ROOT/.htaccess file.

Upvotes: 1

Related Questions