Created
July 14, 2015 13:53
-
-
Save ashalan/fcd77e35da9cd9833596 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/domain_path_rewrite.module b/domain_path_rewrite.module | |
index 6b8d684..d658e5c 100644 | |
--- a/domain_path_rewrite.module | |
+++ b/domain_path_rewrite.module | |
@@ -38,8 +38,13 @@ function domain_path_rewrite_url_inbound_alter(&$path, $original_path, $path_lan | |
*/ | |
function domain_path_rewrite_url_outbound_alter(&$path, &$options, $original_path) { | |
if ($domain_path = _domain_path_rewrite_domain_path($original_path)) { | |
- $path = $domain_path['url']; | |
$options['external'] = strpos($path, '//') !== FALSE; | |
+ if ($options['external']) { | |
+ $path = $domain_path['absolute_url']; | |
+ } | |
+ else { | |
+ $path = $domain_path['url']; | |
+ } | |
} | |
} | |
@@ -68,7 +73,9 @@ function _domain_path_rewrite_domain_path($source) { | |
$cache[$row->source] = array( | |
'domain_id' => $row->domain_id, | |
'path' => $path, | |
- 'url' => $domains[$row->domain_id]->scheme . '://' . $domains[$row->domain_id]->subdomain . ($path ? '/' . $path : ''), | |
+ 'domain' => $domains[$row->domain_id]->scheme . '://' . $domains[$row->domain_id]->subdomain, | |
+ 'absolute_url' => $domains[$row->domain_id]->scheme . '://' . $domains[$row->domain_id]->subdomain . ($path ? '/' . $path : ''), | |
+ 'url' => ($path ? '/' . $path : ''), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment