Page MenuHomePhabricator

Make /entity/ alias work for Commons
Open, NormalPublic


Wikidata has entity URLs in the form of - which is redirected to and ultimately to

It makes sense to have the same setup for Commons - so that Commons URL would redirect to (and of course carry over all suffixes and query strings just like Wikidata does).

Also statement URIs - like or - should be supported, they should redirect to L40053 and M40538870 entity pages respectively.


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


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

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""