htaccess Question

blacktrilby

Supreme Member
Joined
Dec 9, 2008
Messages
1,317
Reaction score
1,122
I want to move a site from joomla to wordpress.
All the current urls have underscores in them

Is the a way to do a permanent redirect for all urls
eg. mysite.com/this_is_a_page

to
mysite.com/this-is-a-page

or would I have to redirect all pages seperately?
Thanks
BT
 
Thanks but what I want to know is, is there a way to do it just using one rule or will I have to do it for every url?
 
I want to move a site from joomla to wordpress.

All the current urls have underscores in them

Is the a way to do a permanent redirect for all urls

eg. mysite.com/this_is_a_page

to

mysite.com/this-is-a-page

or would I have to redirect all pages seperately?

Thanks

BT


You need to use this code and repeat it for the max number of _ possible, add another pattern & replacement.

assuming php pages:

Code:
rewriteRule ^([^_]*)_([^_]*)\.php$ mysite.com/$1-$2.php [R=301,L]
rewriteRule ^([^_]*)_([^_]*)_([^_]*)\.php$ mysite.com/$1-$2-$3.php [R=301,L]
etc....

(I can't post the URLs correctly, add http in front of the domain)
 
Last edited:
Thank you so much. I will give it a go :)
 
Back
Top