One of the biggest advantages of If-So is that instead of duplicating pages you can use a single page and simply add or replace a specific piece of content. Nevertheless, in some cases, you might prefer using conditions in order to redirect visitors to a completely different page.
Redirecting visitors based on conditions can be done using a shortcode that you can paste on the page you want to redirect from.
* Make sure to replace http://www.example.com with the URL of the page you want to redirect to.
When JavaScript redirect is performed, the referrer source will be transferred to the target page (in most browsers, all popular ones).
JS redirect can be used inside a trigger that loads with Ajax (page caching compatibility)
PHP redirects (301/302 redirects)
301 and 302 redirects do not work with Ajax loading. If you paste the redirection shortcode inside an If-So trigger, make sure to add the parameter ajax=”no” to its shortcode (or use JS redirect instead).
* Make sure to replace http://www.example.com with the URL of the page you want to redirect to.
PHP redirects can’t be performed when loaded as dynamic content inside an If-So trigger loaded with Ajax. You can add ajax=”no” to the trigger shortcode to override the default loading settings if you choose to load triggers with Ajax.
How to create the smoothest redirect possible
Make sure to load the trigger without Ajax. The best practice is to add the parameter ajax=”no” to the trigger’s shortcode so that even if you change the Ajax settings on your site in the future, the trigger with the redirection will not be affected.
Use a 301 or 302 redirect (and not a JS redirect).
Step by step: How to redirect visitors to a different page based on dynamic conditions
On your WordPress dashboard, under If-So, click “Add new trigger”
Name your trigger (optional)
In Version A, select the condition for the redirection
Switch Version A content field to text mode, and paste the above JavaScript code. Make sure to replace http://www.example.com with the URL of the page to which you want to redirect.
Set up the default content. If you want nothing to happen when the condition you have set for the redirect is not met, simply leave the default content blank
Hit “Publish”
Paste the trigger shortcode as high as you can on the page to which you want to redirect.