I’m moving an old DotNetNuke site to WordPress and though the old site is really crappy architecture and crashes on a regular basis – the site has a fair amount of SEO cred. So, I don’t want to lose anything, but the regular expression is killing me for the .htaccess-based 301 redirect.
Here’s an example of an old domain post:
http://yoursite.com/tabid/57/listid/4379/Home++Garden/Life+in+Shambles+How+to+Be+Organized.aspx
Here’s how the new one looks:
http://newsite.com/tgesting-new-functionality/
Any help would be greatly appreciated. I’m helping a friend on the site (it’s not mine) and I don’t want to set him back at all and I’m not great with the RegExs.
Thank you!
For redirect
to
You must set in server config at virtual host configuration
In your
.htaccess
fileThe
RewriteMap
directive defines a Rewriting Map which can be used inside rule substitution.RewriteRule ^([^+]*)+(.*)$ $1-$2 [L]
Replace all + by –RewriteRule "(.*)" "${lowercase:$1}" [NC]
Transform to lowercaseRewriteRule /([^/+]+).aspx http://newsite.com/$1/ [R=301,L]
Do the redirectionIf you need replace consecutives + by a single -, just use
RewriteRule ^([^+]*)[+]+(.*)$ $1-$2 [L]
insteadRewriteRule ^([^+]*)+(.*)$ $1-$2 [L]