redirecting pdf

Ben Baker asked on September 24, 2017 21:10

Hi,

I am migrating content from an old website to our new website. there are a handful of pdfs that are hosted in the cms on the existing website which are used on our crm system. when we switch the new website over, these links will no longer work.

I am looking for a way to redirect the pdfs to a new URL in the kentico cms without having to update the links in our CRM system.

I have been able to setup 301s successfully for content pages, but not sure how to do this for pdfs. can someone advice how I can do this please?

thanks,

Ben

Recent Answers


Varinder Singh answered on September 25, 2017 04:58 (last edited on September 25, 2017 04:59)

Depending on the number of files you're wanting to redirects it may be quicker to implement those at the server level (web.config file)

<system.webServer>
    ...
    <rewriteMaps name="pdfRedirects" defaultValue="">
        <add key="/old/site/file/path.pdf" value="/new/site/file/path.pdf" />
        <add key="/old/site/file/path-another.pdf" value="/new/site/file/path-another.pdf" />
        ...
    </rewriteMaps>
    <rewrite>
        <rules>
            <rule name="PDF Redirect Rule" stopProcessing="true">
                <match url="(.*)"/>
                <conditions>
                    <add input="{pdfRedirects:{REQUEST_URI}}" pattern="(.+)"/>
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{C:1}" appendQueryString="false" redirectType="Permanent" />
            </rule>
            ...
        </rules>
    </rewrite>
</system.webServer>
0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on September 25, 2017 14:21

Hi,

You may use redirection module This works sweetly. We have used this to redirect 100's of URLS.

Thanks, Chetan

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.