Linking to an External Page or FIle in Navigation
You can have pages link offsite or even to files using the following method:
- Create a new template called “external_link” with a PHP redirect and the custom field name for the URL value (PHP code below)
- Allow this template to use PHP under the template preferences
- Make a new channel named “External Link” with a custom field that is either a text field (to input a URL offsite) or a file upload field (to link to a PDF, Word doc, etc)
- Make this channel managed by Structure under the module channel settings and set the default template to your new “external_link” template
- Assign a new page to this new channel (named the exact same title if desired) and upon visiting you will be redirected to the external page or file
<?php
header( "Location: {exp:weblog:entries}{your_link_field}{/exp:weblog:entries}" );
exit;
?>
Note: Make sure your channel has ‘Automatically turn URLs and email addresses into links?’ turned off under the channel settings