Page MenuHomePhabricator

Make /entity/ alias work for Commons
Open, NormalPublic

Description

Wikidata has entity URLs in the form of http://www.wikidata.org/entity/Q42 - which is redirected to https://www.wikidata.org/wiki/Special:EntityData/Q42 and ultimately to https://www.wikidata.org/wiki/Q42.

It makes sense to have the same setup for Commons - so that Commons URL http://commons.wikimedia.org/entity/M9103972 would redirect to
https://commons.wikimedia.org/wiki/Special:EntityData/M9103972 (and of course carry over all suffixes and query strings just like Wikidata does).

Also statement URIs - like https://www.wikidata.org/entity/statement/L40053-5aa77d7a-4c9e-ba1c-255b-3c8e4ab60d5d or https://commons.wikimedia.org/entity/statement/M40538870-D3B1F1D8-C2E4-4C7B-B562-721D6C94CF25 - should be supported, they should redirect to L40053 and M40538870 entity pages respectively.

Details

Related Gerrit Patches:

Event Timeline

Smalyshev triaged this task as Normal priority.May 2 2019, 6:59 AM

(Just to clarify – Special:EntityData works, it’s “only” the /entity/ redirect that’s missing.)

For wikidata this is done in

puppet/modules/mediawiki/files/apache/sites/wikidata-uris.incl

We should set up a similar set of things for commons I guess.

Smalyshev moved this task from Backlog to Next on the User-Smalyshev board.Jul 29 2019, 7:52 PM

Change 526757 had a related patch set uploaded (by Smalyshev; owner: Smalyshev):
[operations/puppet@production] Support /entity/ and other Wikidata URLs for Commons

https://gerrit.wikimedia.org/r/526757

Smalyshev moved this task from Next to In review on the User-Smalyshev board.Jul 31 2019, 8:10 PM
Smalyshev claimed this task.Aug 1 2019, 6:54 PM
Abbe98 added a subscriber: Abbe98.Aug 22 2019, 6:33 AM

Mentioned in SAL (#wikimedia-operations) [2019-08-27T19:08:58Z] <gehel> starting deployment of Apache config for lexemes / SDoC - T222321

Smalyshev reassigned this task from Smalyshev to Gehel.Aug 27 2019, 7:47 PM
Smalyshev updated the task description. (Show Details)

I'd be in favor of enabling the minimum needed here and just do the entity resolution here, doing the statement sounds a bit more complex as it may work for wikibase because we will redirect to the entity page which will support statement anchors, for commons we redirect to the File page.
As you can see in the existing rewrite rule the statement id is completely ignored:

RewriteRule ^/entity/statement/([QqPp]\d+).*$ %{ENV:RW_PROTO}://%{SERVER_NAME}/wiki/Special:EntityData/$1 [R=303,L]

The fix could be:

RewriteRule ^/entity/statement/([QqPp]\d+)-(.*)$ %{ENV:RW_PROTO}://%{SERVER_NAME}/wiki/Special:EntityData/$1#$2 [R=303,L]

But I doubt that would work for commons.

Change 547541 had a related patch set uploaded (by DCausse; owner: DCausse):
[operations/puppet@production] Revert "Revert "Add L and M to allowed statement starts""

https://gerrit.wikimedia.org/r/547541