Redirect fails when website url schema does not match
-
When WP is configured on, for example, https://example.com and the website is called over HTTPS, as in https://example.com/test123/, redirect fails/
cause:
line 112, in function redirect states:
$userrequest = \Simple301Redirects\Helper::str_ireplace(get_option('home'),'',$this->get_address());
a solution is to remove the schema from the replacement;
$address = \Simple301Redirects\Helper::str_ireplace('https://','',$this->get_address()); $address = \Simple301Redirects\Helper::str_ireplace('https://','',$address); $home = \Simple301Redirects\Helper::str_ireplace('https://','',get_option('home')); $home = \Simple301Redirects\Helper::str_ireplace('https://','',$home); $userrequest = \Simple301Redirects\Helper::str_ireplace($home,'',$address);
This code intentionally written to reflect and preserve the coding principles of the existing code.
An easier way is to do apreg_replace('@^https?://@i', '', $the_variable);
??Would love to see this fixed (in this way, or any other way you see fit) in a next update.
Remon.
- The topic ‘Redirect fails when website url schema does not match’ is closed to new replies.