It would be great if there was an API call to add redirects.
Other modules that are importing content from another CMS could use this API to automatically setup all the necessary redirects.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | path_redirect-5.x-1.x_save_4.patch | 1.33 KB | HorsePunchKid |
Comments
Comment #1
mdlueck commentedsubscribe
We are working through several conversions from static HTML to Drupal. I have been utilizing redirects in the .htaccess file, but something needs to remain on disk else it invokes the:
rule and produces a really ugly URL.
With SSH access to the server, touch produces 0 length files easily, and mkdir directories likewise (assuming the directories from the old site have been deleted...)
An elegant way of handling Drupal migrations would be much appreciated.
Comment #2
HorsePunchKid commentedI'm not sure this will fit the bill, but there's already a relatively convenient (but undocumented)
path_redirect_savefunction that takes a$form_valuesarray and saves it to the database. That array looks something like:I haven't tested it, but something roughly like that could work.
Comment #3
HorsePunchKid commentedIf you need something syntactically more convenient, we could add something like:
This would let you just call:
path_redirect_create('your/source/path', 'destination/or/url');We could also have
path_redirect_saveset default values for the array you pass it; that would also reduce the code required to call it. I'm leaning toward this latter strategy. The same line would look like:path_redirect_save(array('path' => 'your/source/path', 'redirect' => 'destination/or/url'));Comment #4
HorsePunchKid commentedThe last suggestion would works with this patch. Good enough?
Comment #5
HorsePunchKid commentedI committed something more or less like this, only I factored out the default redirect type as a
define. Also, the default value for the argument topath_redirect_savewas not actually useful. You do have to pass it something, after all.Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.