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

jhodgdon’s picture

Priority: Normal » Major

This is high priority

greggles’s picture

We 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.

greggles’s picture

OR 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.

jhodgdon’s picture

Assigned: Unassigned » jhodgdon

I'll take on the task of figuring out a query.

jhodgdon’s picture

Assigned: jhodgdon » Unassigned
Status: Active » Needs review

This 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/%';

Dave Reid’s picture

It looks correct, although it's going to be pretty big so it may want to be tested first.

Dave Reid’s picture

redirect field should be 'node/[nid]'

greggles’s picture

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/%';

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/%';

greggles’s picture

Status: Needs review » Reviewed & tested by the community

OK, 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:

INSERT INTO `path_redirect` (`source`, `redirect`, `query`, `fragment`, `type`) SELECT ua.dst, ua.src, '', '', 301 FROM `url_alias` ua WHERE ua.dst LIKE 'handbook/%';
UPDATE url_alias SET dst = replace(dst, 'handbook/', 'documentation/') WHERE dst LIKE 'handbook/%';

Edited to fix second query per jhodgdon so a copy and paste doesn't fail

jhodgdon’s picture

The 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.

greggles’s picture

Status: Reviewed & tested by the community » Fixed

Now done. It fixed 170 rows.

jhodgdon’s picture

Thanks greggles and davereid for working on this!

jhodgdon’s picture

BTW I tested a few of these that were in my browser history and they're all working just fine. Thanks again!

Status: Fixed » Closed (fixed)
Issue tags: -docs infrastructure, -drupal.org documentation tools

Automatically closed -- issue fixed for 2 weeks with no activity.