You can create a custom Adobe Experience Manager (AEM) Link Rewriter that is based on the Apache Sling Rewriter module. This module is used for rewriting the output generated by the Sling rendering process.
Note: For more information about a Sling Rewriter, see Apache Sling Rewriter.
An Adobe CQ Link Rewriter is implemented as an OSGi bundle that contains a Java class that extends the org.apache.sling.rewriter.Transformer class. For information, see Interface Transformer.
To read this development article, click http://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html.