Hello,
we use ChronoForms version 6.
We have to duplicate a form in order to have several forms with the same fields and almost characteristics except for the name and the redirect URL.
So we wonder if it possible to have a “generic” URL based on the name of the form.
For instance, suppose we have the following page containing the form :
https://www.domain.TLD/acces-quand-la-protection-de-la-vie-privee-rencontre-la-personnalisation
Concerning the redirect URL of the form, we would like this :
https://domain.TLD/quand-la-protection-de-la-vie-privee-rencontre-la-personnalisation
In this case, we would like "acces" to be removed in the redirect URL.
In a general way, can we use a regular expression in order to replace a part of the name of the form with another?
Thanks in advance for your answer.
Regards,
we use ChronoForms version 6.
We have to duplicate a form in order to have several forms with the same fields and almost characteristics except for the name and the redirect URL.
So we wonder if it possible to have a “generic” URL based on the name of the form.
For instance, suppose we have the following page containing the form :
https://www.domain.TLD/acces-quand-la-protection-de-la-vie-privee-rencontre-la-personnalisation
Concerning the redirect URL of the form, we would like this :
https://domain.TLD/quand-la-protection-de-la-vie-privee-rencontre-la-personnalisation
In this case, we would like "acces" to be removed in the redirect URL.
In a general way, can we use a regular expression in order to replace a part of the name of the form with another?
Thanks in advance for your answer.
Regards,
here is a code explame you can use in a PHP action:
// Get the current page URL
$currentURL = $_SERVER['REQUEST_URI'];
// Find the position of "/acces-"
$pos = strpos($currentURL, '/acces-');
// If "/acces-" is found in the URL
if ($pos !== false) {
// Remove "/acces-" and everything before it
$newURL = substr($currentURL, $pos + strlen('/acces-'));
// Redirect to the new URL
header('Location: https://www.domain.TLD/' . $newURL, true, 301);
exit;
}
You need to login to be able to post a reply.