Sitefinity PDF Redirection
sitefinity | .NET, CMS, Sitefinity | 2024-09-20
sitefinity | .NET, CMS, Sitefinity | 2024-09-20
The request is to redirect pdf from the old site url: xxx.com/en/document/sample.pdf to the new Sitefinity site successfully.
By default the pdf uploaded to Documents & Files will adopt the url pattern,
/docs/<provider>/<library_folder>/<file and extension>
We found no way to configure the Documents & Files setting.
We found an archive discussion thread shared the possibility and we went ahead to try on.
Basically it uses Page module as the redirection purpose.
1/ Head to advanced setting /Sitefinity/Administration/Settings/Advanced,
Under Page setting, we will need to update the "Not allowed page extensions" -> remove the .pdf from the list.
2/ Upload a document, we will need the "URL to file" later when setting up Page
3/ Setup the Page structure
We will exclude the en and document page from showing in navigation
Lastly, for the redirect page, we use sample.pdf as the page name and the url will auto populate as "sample.pdf"
as we had allowed the page extension in step 1.
Tick the "Redirect to another page" and use the "URL to file" from step 2. (You may use the relative path)
The purpose of doing the structuring is to categorize the documents into different path structure.
4/ Alternatively, you can also setup 1 redirect page at root with full path as below:
using documents instead of document because the URL "/en/document/sample.pdf" already exists in page: en > document > sample.pdf
5/ Now visit the url xxx.com/en/document/sample.pdf or xxx.com/en/documents/sample.pdf will redirect you the document!