# URI rewriting Customize resource URIs in the Markdown output — CDN URLs, custom paths `DocumentConvertOptions.setUriExportStrategy` controls the URIs written into the Markdown output for exported resources. This is useful when images are served from a CDN or a different path than where they're saved. {{< alert style="info" >}} URI rewriting works with file-based image strategies (`ExportImagesToFileSystemStrategy` or `CustomImagesStrategy`). It has no effect when images are embedded as Base64, which is the default. {{< /alert >}} ## Default behaviour Without an explicit strategy the library uses `DefaultUriExportStrategy`, which writes the relative path configured on the image strategy: ```java ExportImagesToFileSystemStrategy imageStrategy = new ExportImagesToFileSystemStrategy("output/images"); imageStrategy.setImagesRelativePath("images"); // Markdown references: ![](images/img-001.png) ``` For most cases, setting `setImagesRelativePath` on the image strategy is all the URI control you need — see [Save image as file]({{< ref "markdown/java/developer-guide/advanced-usage/strategy/image-file-strategy" >}}). ## Custom URI strategies {{< alert style="warning" >}} **`CustomUriExportStrategy` cannot be used in 26.5.** Its only public constructor takes `com.groupdocs.markdown.uriexport.a` — an obfuscated, package-private type — so it cannot be constructed from user code. Implementing `IUriExportStrategy` yourself and passing it to `setUriExportStrategy` does work. A worked example will be published here once the constructor issue is resolved. {{< /alert >}} ## UriExportContext methods `IUriExportStrategy.updateResourceUri` receives a `UriExportContext`: | Method | Description | |---|---| | `getResourceFileName()` | Default file name generated by the library | | `getResourceFileUri()` | Default URI that would appear in the Markdown | | `setResourceFileName(String)` | Override the resource file name | | `setResourceFileUri(String)` | Override the URI written to the Markdown output |