The custom redirect plugin is designed to give you the ability to specify redirect rules within your Jive site. This tool can be used when you desire a unique URL that should point somewhere in your community or to ensure your user's browser bookmarks work after moving content in your community.
The benefits of this plugin are:
- No need to modify the Apache configuration.
- More robust to future changes to the environment (migration, adding capacity, upgrades).
- Allows for "self-help", i.e. your team can add new redirects at any time.
- No restarts necessary to add new redirects.
- Specify redirect type from: HTTP 301 "Moved Permanently" or HTTP 302 "Found".
How to Use
After installation, the plugin can be configured from the Admin Console -> System -> Management -> Custom Redirection Rules page. Whenever the application handles a new request, it will check against all the input rules in the list; if a match is found, it will issue a redirect to the output URL. Input rules will match on both the full URL (http://mysite.com/communityA) and the URL minus the domain (/communityA).
As a safety feature, rules won't redirect from any URL that begins with /admin. Each rule won't be executed more than once per request, so for example you can't create an infinite loop by creating rules that redirect from A -> B and B -> A. Multiple rules can be executed for each request, however - for example, rules could redirect from A -> B and B -> C, all during one request. The rules will be checked in order from top to bottom, so if you want a rule to be executed before others, bump it to the top.
Changes to the list will take effect immediately, with no need for a restart.
Two types of rules are currently supported:
- Simple rules are an explicit 1:1 match - if the exact input URL is found, the application will redirect to the output URL.
- Regular Expression rules allow the use of Java regular expressions in input and output URLs. This allows the input rule to catch more than one URL, and do simple string replacement into the output URL.
Simple Redirect Rule Example
For example, let's assume that we have a space name called "Sales" that is based at the URL http://mysite.com/community/sales. The Admin of that space later decides to change the name of the space to "Sales Team" and wants to change the URL to http://mysite.com/community/salesteam. Most links inside the Jive application will be automatically updated to accommodate this change but links from outside the application (such as those cached by Google or in your user's browser bookmarks) will no longer resolve! To resolve this discrepancy, navigate to the Admin Console > System > Management > Custom Redirection Rules page and set up a new simple redirection rule that points from /community/sales to /community/salesteam. Now, whenever a user follows a link to http://mysite.com/community/sales, they will be redirected automatically to http://mysite.com/community/salesteam.
Upgrading, Jive 7.0 and Beyond
This plugin is a core feature in Jive 7.0 and later. It is still configurable from the Admin Console -> System -> Settings -> Redirection Rules page and follows the same behavior described above.
There is a bug in the core upgrade tasks that can prevent an upgrade to 7.0.0 or 188.8.131.52 (but not any later version like 7.0.1). If you have installed this plugin, follow these steps before upgrading to 7.0.0 or 184.108.40.206:
1) Before the upgrade, Uninstall the plugin.
2) Deploy the upgrade RPM.
3) While the application is down, run the following:
ALTER TABLE redirectpluginrules DROP CONSTRAINT jiveRule_pk;
4) Start the application and proceed through the upgrade console steps as normal
Caveats and Known Issues
- The tool can only redirect requests for source URLs contained in the domain of the Jive application.
- Make sure new rules are tested on a test site before implementing on production. It wouldn't be hard (especially with regular expression rules) to create redirect rules you didn't intend, which could break parts of a site.
- This plugin is not intended to handle large redirection lists. Instead, these rules should be implemented as Apache rewrite rules.
- The Mobile plugin does something similar to this plugin (catches requests and looks for mobile devices, to redirect them to mobile versions of pages). Since plugin load order isn't predictable, this plugin could interfere with that process. If this occurs, the best solution is to remove the redirect plugin and use Apache rewrite rules instead.
- 301 type redirect rules cannot be used to redirect off-domain (that is, a 301 rule cannot redirect from your site at mysite.com to a different domain such as google.com).
- If your site has a context (mysite.com/mycontext/), input rules will have to include the context: /mycontext/community/sales, for example.
- Simple rules are case insensitive. Regex rules, by default, are case sensitive. You can create a Regex rule that matches insensitively by adding (?i) to the beginning of the input URL.
This plugin is not supported by Jive, and use of this plugin should be done at the user's discretion, or as advised by their Jive Support representative. If you have any questions or issues with this plugin, please comment on this document and let me know.
Copyright 2013 Matthew Jarvie under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|Jive version||Plugin Version|
|5.0.0 - 5.0.6||1.1 - 5.0|
|6.0 - 6.0.3||1.1 - 6.0|