A client moved to a different donation gathering vendor (NationBuilder) and wanted all of Salsa's donation pages redirected to the main donation page on the new vendor. This article describes the solution, the logic behind the solution, and shows the script that was used.
Putting a redirect script into the default template!
Note the "if" statement that makes sure that the script only runs on donation pages (if you need a broader solution, see Variations below).
Testing showed that this script works on all cases of the
field (0, 1, and null).
If you like the script but need to redirect other kinds of pages, then here are some variations to use:
Redirect from one URL to another
Redirect all of another kind of page
donate_page_KEYin the script to
PAGE_TYPE_KEY. The example redirects all action pages:
Redirect Salsa page using a key
- View the page.
- Retrieve the page type and key from the browser's address bar. For example, an event page will have
donate_page_KEYin the script to the page type and key value. The example redirects
Redirect a bunch of different pages
- The best solution will be to use a regular expression to define the pages that need to be redirected. Your best bet will be to describe the pages that need to be redirected and send mail to firstname.lastname@example.org for help.
Initial Idea That Didn't Work
Defining a common redirect template for all donation pages seemed like a good idea at first, but not so much. For his first try, The Great and Powerful Allen created a redirect template which could be built out using the ideas from this StackOverflow discussion. For example:
Once the template is done, then it would be a simple update to the database to change all donation pages to use the same template:
update donate_page set template=TEMPLATE_KEY where organization_KEY=WHATEVER;
Why it didn't work
Salsa checks to see if a donation page is disabled before a page is rendered. (A donation page is disabled if the
Disabled field is
1.) If a donation page is disabled, then Salsa
- ignores the special redirect template,
- stuffs a "not available" message into the default template, and
- renders just the message.
If you have questions, then please gather this information:
- Your organization_KEY
- Your chapter_KEY if you are in a chapter
- The list of page types and page keys that you want to redirect
- The URL(s) where these pages should be redirected.
Send this information to email@example.com and we'll be glad to help.