http://m.cvg.lochttp//cvg.loc/california
I know redirection must be working for other people, so tell me if you think there's something about my setup that's causing this.
With redirection on, and mobile / desktop URL as:
When I go to http://cvg.loc/mypath
, I get redirect to this URL: http:m.cvg.lochttp://cvg.loc/mypath
.
The problem appears to be in mobile_tools_get_redirect_url()
, with these lines:
$currentPath = str_replace(base_path(), "/" ,$currentUrl);
$url = $base . $currentPath ;
$currentURL is "http://cvg.loc/mypath"
base_path()
returns "/", so the domain name isn't getting stripped out of $currentURL
, and the mobile URL in $base
is added.
When I change those lines to this, the problem disappears:
global $base_url;
$currentPath = str_replace($base_url, "" ,$currentUrl);
$url = $base . $currentPath ;
Comments
Comment #0.0
kentr CreditAttribution: kentr commentedUpdated description
Comment #0.1
kentr CreditAttribution: kentr commentedAdded formatting.
Comment #1
kentr CreditAttribution: kentr commentedI think the problem is with domain name language negotiation.
language.inc, language_url_rewrite()
causes the URL returned byurl()
to be absolute:This brings up another issue that on other language subdomains the Mobile URL won't match anyway, so some sort of hook to change the redirect URL would be helpful.
Comment #1.0
kentr CreditAttribution: kentr commentedRemoved stupid assumption.
Comment #2
kentr CreditAttribution: kentr as a volunteer commented