# URI rewriting Customize resource URIs in the Markdown output — CDN URLs, custom paths Use `UriExportStrategy` with `CustomUriExportStrategy` and `IUriSavingHandler` to rewrite resource URIs in the Markdown output. 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. {{< /alert >}} ### Prepend a CDN base URL {{< tabs "uri-cdn">}} {{< tab "C#" >}} ```csharp using GroupDocs.Markdown; public class CdnUriHandler : IUriSavingHandler { public void Handle(UriSavingArgs args) { args.SetResourceFileUri("https://cdn.example.com/assets/" + args.ResourceFileName); } } var options = new ConvertOptions { ImageExportStrategy = new ExportImagesToFileSystemStrategy("output/images") { ImagesRelativePath = "images" }, UriExportStrategy = new CustomUriExportStrategy(new CdnUriHandler()) }; MarkdownConverter.ToFile("business-plan.docx", "output/report.md", options); // Images saved locally to output/images/ // Markdown references: ![](https://cdn.example.com/assets/img-001.png) ``` {{< /tab >}} {{< tab "business-plan.docx" >}} {{< tab-text >}} `business-plan.docx` is a sample file used in this example. Click [here](https://docs.groupdocs.com/markdown/net/_sample_files/developer-guide/advanced-usage/business-plan.docx) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "uri-cdn.zip" >}} ```text output/images/img-001.png (4 KB) output/images/img-002.jpg (41 KB) output/images/img-003.png (14 KB) output/report.md (5 KB) ``` [Download full output](https://docs.groupdocs.com/markdown/net/_output_files/developer-guide/advanced-usage/uri-rewriting/UriCdn/uri-cdn.zip) {{< /tab >}} {{< /tabs >}} ### UriSavingArgs properties | Property | Description | |---|---| | `ResourceFileName` | Default file name generated by the library | | `ResourceFileUri` | Default URI that would appear in the Markdown | | `SetResourceFileUri(string)` | Override the URI written to the Markdown output |