Redirect Template
A redirect page takes web visitors from one URL to another. The redirect template accomplishes this via a header (meta refresh-type) redirect and can be used to redirect web visitors from an outdated URL to the new page, from a short social media-friendly URL to the actual content page, or to track entry points to the page from different promotion campaigns.
The template provided below creates a folder at the root of the site with an index.html page inside it (for example http://www.college.edu/signup/index.html)
. Even if the web visitor navigates to the extensionless URL (for example http://www.college.edu/signup
), the index page is loaded by default. Then, the redirect in the HTML head of the page sends the web visitor to the destination page (for example http://www.college.edu/admissions/recruitment/signup/index.html)
.
Uploading the Template FilesLink to this section
- Download the redirect-template.zip, which contains 3 files:
redirect.tcf
,redirect.tmpl
, andredirect.gif
. - Navigate to the appropriate folder where your Omni CMS template files are stored. This is typically
/_resources/ou/templates
but is specific to each implementation. (If you are unsure where your template files are stored, check the location in Setup >Sites >Site Settings > Production Server FTP Settings panel > "Template Directory" field.) - Upload the zipped template files using zip import.
- Open the redirect.tmpl file in the source code editor.
- By default, this template creates a redirect without any set delay. A delay in seconds can be added by changing the numerical value of the
content
attribute on line 8, for examplecontent="5"
. If you do add a delay, it's recommended to adjust the text in the<body>
to provide a message to web visitors. - Save and close the file.
- Open the redirect.tcf file in the source code editor.
- If your production server uses a default file name other than index.html (for example index.php, default.asp, etc) you will need to update the default file name. If this is the case, then update the filename attribute on line 29 and
extension
attribute on line 30 as appropriate. For example, if the web server is configured to serve default.asp, then the filename be changed to "default" and the extension be changed to "asp". - Save and close the file.
Using the TemplateLink to this section
If you have template groups set up, you may need to add the redirect template to a group so it is available for you and your content editors.
- Navigate to Content > Pages.
- Click +New.
- Choose the "New Redirect" template.
- In the "Destination File" field, select the destination page you want web visitors to end on.
- In the "Redirect URL" field, name the folder to contain the redirect page. This will become the URL for the redirect page (for example enter
give
if you want your redirect URL to behttp://www.college.edu/give/
). - Click Create. You will be taken to the edit view of the new redirect page which shows the redirect in action and ends on the Destination File.
- Click on Source to verify the redirect source code is correct.
- To make this redirect live, click Publish.
- Navigate to the URL on the production server where the redirect was created to verify that the redirect is working correctly.
Updating a RedirectLink to this section
Should you need to modify an existing redirect, you can:
- To update the redirect URL, renaming the folder containing the redirect index page. Be aware that anyone using the previous redirect URL will see a 404 error if they go to that original URL.
- To update the Destination File, edit the redirect index page's source code. Update the
URL
attribute on line 8 with the new destination. Republish the redirect page to make this change live.
After any change, navigate to the live redirect page URL to verify the redirect is working correctly.
If your redirect URL is featured in print media (such as posters or brochures) then avoid renaming the folder containing the redirect. You can always create a second redirect page, with a different redirect URL, pointing to same destination page if needed. This will prevent 404 errors at the original redirect URL.
.htaccess RedirectLink to this section
On an Apache web server, the .htaccess
file at the site root can be modified with 301 redirects. Use the following lines to make sure the rewrite module is configured:
Options +FollowSymLinks
RewriteEngine on
Then for each redirect, specify first the site root-relative URL you want to redirect from, and then the destination URL. For example,
Redirect 301 /redirect.html http://gallena.edu/about/index.html
web.config RedirectLink to this section
On an IIS web server, the web.config
file at the site root can be modified with 301 redirects. Due to the variations of IIS versions, it is best to consult the IIS documentation for your specific version on how to add 301 redirects into the web.config
file.