Confluence has already a feature built-in that is similar. This produces links like (in your case) http://wiki/x/ZgAJ. It is located at (Page) Tools -> Info.
If you want to have it even shorter you would have to implement your own Servlet Filter Module (https://developer.atlassian.com/display/PLUGINFRAMEWORK/Servlet+Filter+Plugin+Module).
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG