Troubleshooting web page redirects
Updated on 20-October-2016 at 10:16 AM
Business Catalyst End of life announcement - find out more details.
You can apply URL redirects to pages, modules, Literature items, and many other content types on your site.
To learn more about setting up redirects, see Managing 301 redirects .
In this article, you'll learn about an alternate method to hand code page redirects. You'll also learn how to resolve common issues that can occur when creating redirects.
Hand coding redirects to route one URL to another page
You can use the interface in the Web Page Details page to add page redirects within the Admin Console, as described in the article Managing 301 redirects . Or, if you prefer, you can hand code (copy and paste) JavaScript directly into the source code of the page that you wish to redirect. The following code example contains JavaScript which redirects a visitor to various URLs for the same site to different web pages:
<script type="text/javascript"><br /> var url = document.location.href.toLowerCase();<br /> if (url.indexOf('domain1.com') != -1) document.location = 'http://domain1.com/index1.htm'; <br /> if (url.indexOf('domain2.com') != -1) document.location = 'http://domain2.com/index2.htm'; <br /> </script>
Update the script above to use the URLs in your website. To learn more about coding redirects, see the following examples:
Using the meta refresh tag on the W3Schools website
JavaScript tutorial on the Tizag website
Troubleshooting broken redirects after importing a spreadsheet with redirect information
If you've imported redirects that are not working, try the following suggestions:
- Use relative links when referencing the page URLs. For example, use the link: /about.html Instead of: http://www.my_domain_name.com/about.html When linking to a relative path, the page can have an extension of .htm, .html or no extension, like these examples: gallery.html gallery.htm gallery No other file extensions are allowed for relative linking of web pages.
- When adding redirects to legacy site pages (in a situation when you've migrated a site from another host provided to this service) you can create 301 redirects from old URLs to your new URLs. This strategy enables you to keep the existing search engine rating. For example, if the legacy site was built in ASP, and the home page url was index.asp, you can now redirect any user accessing that page to index.html. Extensions such as .php, .asp, .cfm, .pl, .cgi, and .htm are allowed. However, you cannot use .aspx, which is reserved for the system. If the destination URL is on an external server (if it starts with the http:// or https:// prefix), any file extension is allowed.
Creating redirects to an external page
To create redirects to an external page, follow these steps:
- Choose Website > Web Pages > Manage URL Redirects.
- Choose the option to Create a URL Redirect.
- In the window that appears, select the existing site page as the source. Enter the external page's URL as the destination URL.
Redirecting external links to a new site hosted on this system
To redirect external links to the current site, follow these steps:
- Choose Website > Web Pages.
- Open the page, expand the Web Page Details, and click Show more options.
- In the 301 Redirect field, enter the absolute path to the external page.
Alternatively, you can also import the redirect information, using the instructions provided in the article: Managing 301 redirects in the Admin Console .
Understanding the supported external extensions for redirects
Currently, this system only allows the most common extensions to be added to 301 redirect when using the web page import tool. These extensions include the following:
".htm", ".html", ".shtml", ".asp", ".cfm", ".php", ".jsp"
Creating a redirect from non-www to www URLs (and vise versa)
It is not possible to create a 301 redirect from the non-www to a www version of the site. To help with search engine indexing, use the search engine's tools (such as Google Webmaster tools) to set the preferred version of the domain.
Unable to access the .htaccess file
This system does not allow access to the .htaccess file for your hosted site. You cannot edit the .htaccess file using this service.