Posted by kentr on October 10, 2012 at 2:45pm
1 follower
Jump to:
| Project: | Mobile Tools |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
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:
<?php
$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:
<?php
global $base_url;
$currentPath = str_replace($base_url, "" ,$currentUrl);
$url = $base . $currentPath ;
?>
Comments
#1
I think the problem is with domain name language negotiation.
language.inc, language_url_rewrite()causes the URL returned byurl()to be absolute:<?phpcase LANGUAGE_NEGOTIATION_DOMAIN:
if ($options['language']->domain) {
// Ask for an absolute URL with our modified base_url.
$options['absolute'] = TRUE;
$options['base_url'] = $options['language']->domain;
}
break;
?>
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.