I have created a rule set to handle login redirects for users on my site. If a user logs in from a page that is set to a different language from that user's language (example: English user logs in on a Japanese page), the user will be redirected to a page with the same language as the page upon which they logged in (in the example, a Japanese page).
To fix this, I want to force my redirects to be the appropriate language path based on the user language.
However, the [site:url] replacement pattern which is provided by Rules includes the language path (because it is the front page).
My front page is https://mysite.com/en.
I want to create a new variable which is the URL of my site minus the language path: https://mysite.com/
I tried creating a variable of type text with a value of
<?php substr("[site:url]", 0, -2); ?>
but for some reason this just gives me the value of [site:url]; it appears that the substr() function has no effect. I don't understand PHP very well so I could be missing something obvious-- I just want to remove the last two characters of the [site:url]. How can I do this within Rules?