In addition to the discussion about wildcards (http://drupal.org/node/182512) I'd like to propose the following:
Maybe it's an idea to do something like apache's mod_rewrite. That the path matching is like RewriteCond and then optional RewriteRules will rewrite the path. things like http://drupal.org/node/195853 would be possible.
for example the path "the/quick/brown/fox/jumps/over/the/lazy/dog"
match paths
Array
(
[0] => the/quick/brown/fox/jumps/over/the/lazy/dog
[1] => the/quick/brown/fox/jumps/over/the/lazy/<*>
[2] => the/quick/brown/fox/jumps/over/the/<*>/dog
[3] => the/quick/brown/fox/jumps/over/the/<*>
[4] => the/quick/brown/fox/jumps/over/<*>/lazy/dog
[5] => the/quick/brown/fox/jumps/over/<*>
[6] => the/quick/brown/fox/jumps/<*>/the/lazy/dog
[7] => the/quick/brown/fox/jumps/<*>
[8] => the/quick/brown/fox/<*>/over/the/lazy/dog
[9] => the/quick/brown/fox/<*>
[10] => the/quick/brown/<*>/jumps/over/the/lazy/dog
[11] => the/quick/brown/<*>
[12] => the/quick/<*>/fox/jumps/over/the/lazy/dog
[13] => the/quick/<*>
[14] => the/<*>/brown/fox/jumps/over/the/lazy/dog
[15] => the/<*>
[16] => <*>/quick/brown/fox/jumps/over/the/lazy/dog
[17] => <*>
)
$r = db_fetch_object(db_query("SELECT path, redirect, query, fragment, pattern, substitution, type FROM {path_redirect} WHERE path IN ('". implode("','", $paths) ."') LIMIT 1"));
// if pattern and substitution are not empty substitute requested path using pattern
Comments
Comment #1
casey commentedYou could also add a callback so other modules can do the substitution (I would like this very much so I can integrate this module with the one I am working on).
Comment #2
luti commentedSo, where we are now with all those ideas and suggestions?
Basially, I would need only a wildcard functionality (mainly to redirect all unsuccessful requests - blocked by captcha - from engines which don't respect robots.txt, to some page - not to fill my log with their issues, not mine), and from Add Wildcards to Redirect Paths and wish list: redirect non-Drupal URL -- here's why... I've found this to be a final destination where to look a solution for. However, it is just some proposal (reasonable, I have to say), as I understand it.
When can we expect to have some workng patch (or, at least some of this functionality added to development version)?
Comment #3
HorsePunchKid commentedI'm getting close to simply committing this patch in order to force people using the dev version to test it. I'll try and sort out the issue in comment #13 there before I do so, but I may end up committing it regardless and opening an issue for it.
Once that's in, I can look into these issues again. "When?" is always a tough question, but I'd like to have at least the "add wildcards" patch updated to work against 5.x-1.x-dev sometime today. I hope you can help test said patch to get it ready to commit!
Comment #4
dave reidMarking this as a duplicate of #182512: Add Wildcards to Redirect Paths for simplicity.