Path Redirect could perform an export of its rules to file-based storage. This way redirects could be performed by webserver, skipping php completely. The action would be performed manually by developer or site admin, from time to time, or even programmatically.
I think this feature would fit nicely as additional feature to increase performance, not completely replacing drupal-based redirects but complementing it: webserver redirects and drupal redirects could be combined using any ratio (based on human decision or an algo).
I also suggest to make export operations as plug-ins so different formats could be supported (Apache .htaccess, nginx rules etc).
Comments
Comment #1
dave reidOut of scope for 1.0 features, so moving to the new redirection api module for consideration.
Comment #2
dave reidComment #3
mlncn commentedAnyone tried this in any form yet? Would be hugely useful.
Comment #4
mlncn commentedOK i went and started it: http://drupal.org/sandbox/mlncn/1371080
The redirects thus produced are completely untested, recommendations welcome.
Comment #5
dave reidNo patch = active
Comment #6
gregglesNow that there's a separate module I suggest this issue be "works as designed" or something and a link to that module added to the project page.
Comment #7
dave reidI'd still like to leave this as postponed for something to consider after 1.0 release.
Comment #8
mlncn commentedIt's just a sandbox module and could become a patch to or submodule of of Redirect, and i will wait for Dave Reid's call on that. It is tested and works and now exports in two styles Apache uses, Redirect and using Rewrite Rule.
http://drupal.org/sandbox/mlncn/1371080
However it was written with the intention of disabling Redirect module entirely as the cleanest workaround to #1370964: Redirect interferes with hook_custom_theme. Much, much cooler would be to allow Redirect module to be configured to take no action in hook_init() ever, but instead export its rules automatically. Direct export of redirect rules to Apache is theoretically possible.
Comment #9
jordanmagnuson commentedThis looks like a really good idea.
Comment #10
jordanmagnuson commentedJust used mlncn's sandbox module today to export about 5000 redirects, and it worked like a charm. Nice work Benjamin! Exporting redirects as Apache rules automatically would be really, really awesome.
In any case, I think your sandbox module is far enough along already to deserve a full release (or integration into the redirect module).
(The one tiny thing I would point out is that the module name should match the directory/project name: redirect_export.module, rather than redirectexport.module.)
Comment #11
liquidcms commentedjust a comment..
i havent looked at this module yet but it does sound like the better performance way to go. but sadly, my starting point is a csv file of redirects, and since neither Redirect or (i'm guessing) this module have direct import capability; i am still without a method to import.
so ideally either this module or redirect would allow for import from a csv file
Comment #12
jordanmagnuson commentedI agree that import capability would be nice. Perhaps "redirect_import_export"?
Comment #13
mlncn commentedReleased http://drupal.org/project/redirect_export as a full project since it was requested of me and is working for people. I'd love someone to take on automatic export but for me the module is bugfix only right now.
As for importing and then exporting, if you want to go straight from CSV to Apache rules, i'd recommend just using a spreadsheet to make a formula to manipulate the paths into producing the rules and copy paste the result.
Comment #14
honza pobořil commentedIf you care about performance, just use reverse proxy (Varnish, ...). It will cache not only pages but redirects too.
Comment #15
gregglesRe #14, while I agree that a reverse proxy is a great solution, it isn't always an option. Especially on shared hosting solutions there's just no way to do that. Are you poposed to this feature or just voicing some advice/insight?
Comment #16
pere orgaAnswering #11, redirects can be imported by Path redirect import.
Comment #17
wylbur commentedClosing this as Outdated as Drupal 7 is EOL.
Comment #18
c-logemannOpen Issue again because functionality still makes sense for D11+.