On this page
Setting up a redirect using If-So is simple. Just paste the following shortcode on your page, and replace the URL (example.com) with the URL to which you want to redirect the visitors.
[ifso-redirect url='https://example.com']
Whenever users encounter a page with the shortcode, they will be redirected to the page you have set.
To establish a conditional redirect, follow these steps:
Whenever the condition is met, the shortcode will be rendered, and the user will be redirected to the relevant page.
For a step-by-step guide, click here or scroll down to the bottom of the page.
Gutenberg and Elementor users may create the conditional redirect in an alternative way:
– More about conditional Elementor Elements >>
– More about conditional Gutenberg Blocks >>
If-So offers three types of redirections: JavaScript redirect, 301, and 302 redirects. By default, the redirection shortcode will create a JavaScript redirect. If you want to set up a different type of redirect, add the “Type” parameter to the shortcode.
JS redirect:
[ifso-redirect url='https://example.com' type='js']
* Make sure to replace http://www.example.com with the URL of the page you want to redirect to.
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).
301 (permanent) redirect:
[ifso-redirect url='https://example.com' code='301']
* Make sure to replace http://www.example.com with the URL of the page you want to redirect to.
302 (temporary) redirect:
[ifso-redirect url='https://example.com' code='302']
* Make sure to replace http://www.example.com with the URL of the page you want to redirect to.
To prevent a second redirection, incorporate the parameters name=’NAME_YOU_CHOOSE’ and do_once_per=’XXX’ (where XXX represents the number of seconds for which the second redirection is to be avoided).
[ifso-redirect url='https://example.com' code='301' name='example-once' do_once_per='86400']
With the above shortcode, a user will be redirected to the URL example.com once. If the user encounters the shortcode again, no redirection will occur for a period of 1 day (86,400 seconds).
The parameter “do_once_per” can also be set to the value ‘session’ if you prefer the redirection to happen only once during a browser session.
Use a single shortcode to redirect each page on your site to an equivalent page on a parallel website.
And more…
Click here to learn more about Geolocation Redirect Templates.
.com → .co.uk
.com/… → .com/uk/…