In #222515 morphir attempted to add a url alias with a request parameter.
Example:
commitlog?repos=1
When the handler is being determined the entire string is used instead of the path portion.
The desired path being:
commitlog
I wrote a simple patch that corrects this by checking for variables in the path. It then corrects the path and parses the variables. The variables are then added to the appropriate arrays so that modules can process them like normal.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | url_alias_with_query.patch | 952 bytes | boombatower |
Comments
Comment #1
boombatower commentedI suppose I should attach the patch.
I assume this could be adapted for 6.x and HEAD.
Comment #2
chx commentedSomething is not right, get q does not contain the query string.
Comment #3
chx commentedComment #4
cwgordon7 commentedComment #5
dugh commentedsubscribe, I had a patch to do this in drupal 5, but forgot it. I need a patch for drupal 6 now.
Comment #6
brian_c commentedI have this working in D7 via hook_url_inbound_alter(): http://drupal.org/node/118072#comment-4706374
Comment #7
killah89 commentedGot to work for D6 please.
Thanks :D
Comment #8
geek-merlinThis totally makes sense. Patch looks like a good starting point.
D8 will take a totally different approach so tagging this D7.
Comment #9
amit0212 commentedI think you can do this with the Redirect module (it won't provide an alias in its truest form but it will forward you on to the right page).
In .htaccess you could a custom RewriteRule before Drupal's main index.php rule:
RewriteRule ^myownstuff$ stuff?owner=myself [L,QSA,R=301] # QSA and R=301 are optional here
If neither of these work there is a quick and dirty way in a custom module:
function MYMODULE_init() {
if ($_GET['q'] == 'myownstuff') {
drupal_goto('stuff', array('query' => array('owner' => 'myself')));
}
}
If you've got more than one path to forward/a pattern etc. you'll have to extend this a bit but the logic will work.
I think the .htaccess is probably the best way as it doesn't actually forward on to the URL but masks it internally which I guess is what you're after.
You might also want to look at hook_url_inbound_alter() which I believe you can use to get this kind of functionality...I've not used it before so I can't comment further though.