Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
All the aliases currently on drupal.org that are /handbook should be renamed to /documentation (presumably with permanent redirects added from the old to new alias).
Comments
Comment #1
jhodgdonThis is high priority
Comment #2
gregglesWe probably don't want to do this manually - there's 172 of them.
We can update the aliases like:
update url_alias set dst = replace(dst, 'handbook/', 'documentation/')where dst like 'handbook%';
I'm happy to run that. Tricker is how to create the redirects. We could either use path_redirect or a single redirect in the apache configuration (i.e. htaccess).
If someone wants to figure out the query to create these as redirects in the path_redirect table I'll be happy to qa/run the queries.
Comment #3
gregglesOR if someone wants to document the .htaccess change (and killes/nnewton/whomever are OK with an .htaccess redirect) I could review (but not implement) that.
Comment #4
jhodgdonI'll take on the task of figuring out a query.
Comment #5
jhodgdonThis should do it:
INSERT INTO `path_redirect` (`source`, `redirect`, `query`, `fragment`, `type`) SELECT ua.dst, replace(ua.dst, 'handbook/', 'documentation/'), '', '', 301 FROM `url_alias` ua WHERE ua.dst LIKE 'handbook/%';
Comment #6
Dave ReidIt looks correct, although it's going to be pretty big so it may want to be tested first.
Comment #7
Dave Reidredirect field should be 'node/[nid]'
Comment #8
gregglesINSERT INTO `path_redirect` (`source`, `redirect`, `query`, `fragment`, `type`) SELECT ua.dst, replace(ua.dst, 'handbook/', 'documentation/'), '', '', 301 FROM `url_alias` ua WHERE ua.dst LIKE 'handbook/%';
I think we want the "redirect" field to be in the form of "node/NID" so I'm using ua.src instead of the replace business.
INSERT INTO `path_redirect` (`source`, `redirect`, `query`, `fragment`, `type`) SELECT ua.dst, ua.src, '', '', 301 FROM `url_alias` ua WHERE ua.dst LIKE 'handbook/%';
Comment #9
gregglesOK, I think this is ready to go but would like to at least give it enough time for folks in Europe to review.
I tested out the queries by limiting them to "handbook/blocks" instead of the % and they worked find for http://drupal.org/documentation/blocks
So, I plan to run these two queries on Monday:
Edited to fix second query per jhodgdon so a copy and paste doesn't fail
Comment #10
jhodgdonThe second query should end in LIKE 'handbook/%' (there's a missing /).
Also these queries will miss the main handbook (no suffix) page, so I guess we should do that one manually.... No, it's already working. If I try to type in drupal.org/handbook I am already being redirected to drupal.org/documentation, so someone apparently already took care of that alias/redirect.
Comment #11
gregglesNow done. It fixed 170 rows.
Comment #12
jhodgdonThanks greggles and davereid for working on this!
Comment #13
jhodgdonBTW I tested a few of these that were in my browser history and they're all working just fine. Thanks again!