Redirecting Old PDF URLs to New Sitefinity URLs
sitefinity | 2024-09-20
🚩 Introduction
When migrating to a new Sitefinity website, we encountered a need to redirect legacy PDF links from the old URL structure (e.g., xxx.com/en/document/sample.pdf) to their new locations.
By default, Sitefinity stores uploaded documents under the following URL pattern:
/docs/<provider>/<library_folder>/<file and extension>
Unfortunately, Sitefinity does not offer direct configuration options to modify this URL structure for Documents & Files.
We found no way to configure the Documents & Files setting.
🔍 Workaround Solution
After researching community discussions, we discovered a creative workaround using the Pages module to simulate the desired PDF redirection behavior.
Here's the step-by-step guide:
1. Update Allowed Page Extensions
Navigate to:
Sitefinity Backend ➔ Administration ➔ Settings ➔ Advanced ➔ Pages
Under the Pages settings:
- Locate the "Not allowed page extensions" setting.
- Remove
.pdffrom the list to allow Sitefinity pages to have a.pdfextension.

This change enables the system to create pages that end with .pdf.
2. Upload the Document
Upload your PDF file to the Documents & Files module.
- Note: You will need the "URL to file" for later when setting up the redirect.

3. Set Up the Page Structure for Redirection
- Create the necessary page hierarchy to match the original URL path (e.g.,
/en/document/). - Exclude intermediate pages (like
/en/and/document/) from navigation if they are only meant for structuring.

Use the page settings to hide from navigation:

- Create a final page named
sample.pdf. - Since
.pdfis now an allowed extension, the URL will properly end with.pdf.
For this sample.pdf page:
- Check "Redirect to another page".
- Set the target to the document's URL obtained in Step 2 (you can use a relative path).

The structured approach categorizes and redirects documents cleanly.
4. Alternative: Root-Level Redirection
Alternatively, you can create a single redirect page at the root if matching the full path is challenging.
⚡ Important: Be aware of URL conflicts if the same path already exists as a structured page.
Example: /en/documents/sample.pdf
Use
/documents/instead of/document/if/document/is already taken.

5. Test the Redirection
Now, visiting:
xxx.com/en/document/sample.pdf
orxxx.com/en/documents/sample.pdf
should correctly redirect to your uploaded PDF document!