We recently did a migration from a "custom CMS" (coded from scratch) to our current technology news/reviews site, MuyComputerPRO, which we installed in WordPress a couple of weeks ago.

The migration process has been long and complex, and we are now facing the colateral damage: old-duplicated URLs (more on this later) don't work, giving a 404 error page.

The old CMS generated URLs dinamically, and those permalinks weren't permanent. The last part of the link was a alphanumeric code that also could change from article to article, so the same webpage could have several different URLs. I know. I arrived here late.

We have managed to get the "last" permalink that was assigned to each article, and we have setup this permalink as the one used on WordPress after a database migration. This way, each of the old articles have at least a good URL that Google already knows about.

The problem is, the rest of duplicated URLs are lost, and Google Webmaster Tools has noticed this and gives a report with thousands of 404 errors on those duplicated links (our database has over 12.000 articles).

I think the only solution to this is to create 301 redirections. Our web server is Nginx, and althoug I've investigated how to accomplish this in Nginx, the current solutions don't fit well in our model.

Examples of a bad/duplicated URL:


And the good one is


As you can see, the final code is the one that must be changed, and I fear there's no "general" 301 redirection rule for that.

Will we have to specify ONE BY ONE the bad and good URLs? We could that (there's a Wordpress plugin, called Redirection, that let's you do this in a simple way), but it would be a little hell :(

Please, help!!


My suggestion is to write a file with redirection rules for nginx and include it on the server config. You can also use a script to automatically generate the rules.

rewrite  /Actualidad/Protagonistas/Nueva-estructura-de-SAP/_wE9ERk2XxDBuybOru8KSMQ5WAzIEAjFyaz70NzGocxqh0Aam7PBrCxu9Dl2Y0RcK /Protagonistas/Nueva-estructura-de-SAP/_wE9ERk2XxDBuybOru8KSMW2WfV_v9dGn6boQF-rm0B25JbFBs4Bqve7uMmhtXVNn permanent

Create a file with lines like these and use include to add them to the config.

But yes, you're right, unless this code at the end of the URL can be generated by a regex or something like that, there's no way to make it automatic.

  • That is precisely what we can do with the Redirect plugin, but from WordPress itself, and not inside Nginx conf. And that's what I'd like to avoid. We'll have to search each equivalence (old->new) and perform the redirection one by one :( Another possibility: to edit old permalinks (from the old CMS), truncate them and leave them without the last part (the large code after the last slash) and from there, create a redirect rule, this time with a regular expression, something like: www-muycomputerpro-com/(.*)/(.*)/(.*)/(.*) www-muycomputerpro-com/$1/$2/$3 – javipas Dec 6 '10 at 19:39
  • 1
    You can try this rule rewrite ^/(.*)/(.*)/(.*)/(.*)$ http://www.muycomputerpro.com/$1/$2/$3 permanent – coredump Dec 10 '10 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.