Adding Redirects
Adding a New Redirect
To create a new redirect, go to the Redirect Manager tab and click Add New, as shown in the screenshot below:
A new form will appear, allowing you to enter details for the new redirect. Use this form to define the redirect actions and specify which links should be redirected. See the screenshot below for reference
Form Fields
In the form shown above, you’ll find the following fields:
- Redirect Status: Enable or disable the redirect.
- Group: Assign the redirect to a specific group for better organization.
- Redirect From: Specify the redirect source. Various source types are available, including Page, Folder, Regex, Start With, End With, Contain, and File Type (explained in detail below).
- Redirect To: Define the destination for the redirect, which can be a Page or Folder.
- Redirect Type: Choose the type of redirect—301, 302, or 307. The 301 type is preferred for SEO as it permanently redirects a page or any 404 error link.
Redirect From Types
Page: Use this type for a single link, like http://www.wp-buy.com/aboutus.htm
.
Folder: Use this type to redirect an entire folder, such as http://www.wp-buy.com/products/
. Additional options will appear if this type is selected. See the image below for more details:
In the dropdown list shown above, you’ll find three options for handling folder redirects:
- Only the Folder: This option redirects only the folder itself, not its contents or subfolders. For example, if the folder is
/products/
(the same ashttp://www.wp-buy.com/products/
in relative form), links like/products/overview.htm
will not be redirected. - The Folder and its Content: This option redirects both the folder and any content within it. You can choose whether to include subfolders from an adjacent dropdown list.
- Only the Folder Content: This option redirects only the folder’s content, so the folder
/products/
itself will not be redirected, but/products/overview.htm
will be.
Regex
The plugin also supports regular expressions for advanced redirect configurations. Note that it uses MySQL regular expressions, which differ from .htaccess
regex. You can use an online tester, like regexr.com, to practice.
For example, to redirect from a Day and Name permalink structure (/2019/04/02/post_name/
) to a Post Name structure (/post_name
), follow the steps shown in the image below:
*****Image needed*****
Note on Regular Expressions
In regex, [0-9]
indicates a numerical value, and {4}
specifies the number of digits (e.g., a four-digit year). The group (.*)
represents any string, forming a single group within brackets, referenced as $1
.
Redirect From Types
- Start With: Redirects any link starting with the specified string in the Redirect From field. For instance, if you specify
/main
, links like/main-page.html
and/mainproducts/myproduct/
will be redirected, while/the-main-page.htm
or/products/one-product/
will not. - End With: Redirects any link ending with the specified string in the Redirect From field.
- Contain: Redirects any link containing the specified string. For example, if
mysql
is used, links like/learn-mysql-database.htm
and/databases/mysql-db/connection/
will be redirected. - File Type: Redirects files of a specified type. For example, using
asp
would redirect/learn-mysql-database.asp
and/databases/mysql-db/connection.asp
.
Redirect To Types
- Page: Used for redirecting to a single link.
- Folder: Ideal for wildcard redirects, where the folder and all its contents are redirected to another folder.
- Regex: Supports regular expressions based on MySQL syntax, though it differs from
.htaccess
regex. - You can explore regular expressions further and test them with tools like regexr.com.