MetaRedirect

Overview

MetaRedirect is a lightweight module that allows any post to redirect itself automatically to a URL stored in a custom field. Assuming you are using a custom post type that 1) stores a URL in a custom field, and 2) you need to provide front-end access to the location, then MetaRedirect is for you. You can use MetaRedirect in cases where your posts need to act as pass-through for a different destination, either internal or external. You can also use this plugin to simplify the management of conditional redirections.

This plugin does not have any side-effects, uses WordPress-native functionality, and a minimal amount of resources.

This is not a plugin designed to manage standard HTTP redirections; rather, it is an extension meant to simplify and automate redirections based on URLs stored in the post.

Configuration

The plugin's functionality can be enabled or disabled from the settings page. Important: If you leave the Enabled box unchecked, the plugin will have no effect at all.

You can configure MetaRedirect to use any existing custom field to store the value of the target URL.

You can set up the redirection to either permanent (301), or temporary (302). Using the former setting, the client browsers or search engines that hit your post’s page will remember the redirection and perform it automatically the next time they visit your post. If you use a temporary redirection instead, those clients will request the redirection anew. In other words, only use Permanent (301) redirections if you know that the target will never change.

You can configure the redirection trigger to be permanent or provisional. A permanent trigger will enforce the redirection automatically. A provisional trigger will only perform the redirection when a preset query parameter (see below) is present in the requested URL. For example, if you set the trigger parameter to jump, the post’s URL will be redirected if, and only if, it contains the query: ?jump; otherwise no redirection will happen and the post will display as usual.

The trigger parameter is a string used to trigger provisional redirections (see above). URL parameters appear after the question mark (“?”) in the URL. Though query parameters typically consist of key/value pairs separated by an equal sign (e.g., key=value) the MetaRedirect provisional trigger only requires the key to be present (the left side of the =) and will ignore any associated value.

Finally, you can set the redirection to append custom URL parameters to the target These additional parameters need to be URL-encoded key/value pairs; the parameters will be merged with the original URL seamlessly.

Usage

 

Leave a Reply

Your email address will not be published. Required fields are marked *

plugins.logo
Copyright © Codecide