What would the best way to setup (configure) URLs used in previous versions of a site after a site is converted to a new Drupal site?


You want to consider using the path module.

If your old site followed a fixed scheme and you have a lot of urls, you might also be able to leverage the pathauto module. Here is a quote about it (from its project page):

... creates automatic path aliases for content, users, and taxonomy terms, eliminating the need to create them manually. This way, your site is more user and search engine friendly, and more descriptive about its content with less work from your side.

| improve this answer | |

The best way is to write your own import module which uses path_set_alias() to assure that the url of the page on the new site is the same as that on the old site. You can use Drupal's batch operations API to do this for you. This gives you more flexibility than simply using pathauto.

If you aren't able to do this, try to approximate your old site's urls with pathauto. Note that when you import, the paths probably won't be set with pathauto - you will need to go to the pathauto interface in order to generate these url aliases (they are called url aliases, since Drupal itself makes urls in a different way - but allows you to add url's to a page by means of these aliases).

If you're doing this for SEO reasons, you'll also want to find a way to add the canonical metatag for pages which aren't aliased, to prevent yourself from getting a duplicate content penalty. Implementing this will probably vary, depending on whether you're using Drupal 6 or 7. It seems that the nodewords module has this functionality for D6 - just a suggestion, as I haven't used it.

| improve this answer | |

Modules that won't help

IMHO this question cannot be solved by either Path (core module) or Pathauto (contrib module), as suggested in one of the other answers. Because those modules serve another purpose.

Possible solution

However, a possible solution for addressing the issue as described in the question, is to use the Path Redirect module instead. Here is a quote about it (from its project page):

... allows you to specify a redirect from one path to another path or an external URL, using any HTTP redirect status.

The Path Redirect project page also includes some suggestions for related modules to be considered (which however serve another purpose related to paths).

Recommended solution

Yet another approach is to use Drupal's contributed module "Rules". Refer to my answer to the question "How to use the Rules module to implement a custom redirect for an outdated URL?" for (way) more details on that.

| improve this answer | |

Your Answer

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