Skip to content

Instantly share code, notes, and snippets.

@ashalan
Created June 29, 2015 17:56
Show Gist options
  • Save ashalan/68a59964fe9288a0a9da to your computer and use it in GitHub Desktop.
Save ashalan/68a59964fe9288a0a9da to your computer and use it in GitHub Desktop.
diff --git a/domain_path_rewrite.module b/domain_path_rewrite.module
index ac798af..c1ef06d 100644
--- a/domain_path_rewrite.module
+++ b/domain_path_rewrite.module
@@ -18,7 +18,16 @@ function domain_path_rewrite_init() {
*/
function domain_path_rewrite_url_inbound_alter(&$path, $original_path, $path_language) {
global $_domain;
- $domain_key = empty($_domain['machine_name']) ? domain_load($_domain['domain_id'])['machine_name'] : $_domain['machine_name'];
+
+ $domain_key = '';
+
+ if (empty($_domain['machine_name'])) {
+ $load = domain_load($_domain['domain_id']);
+ $domain_key = $load['machine_name'];
+ }
+ else {
+ $domain_key = $_domain['machine_name'];
+ }
$redirect_source = $domain_key . ':' . ($original_path ? $original_path : '<front>');
if (module_exists('redirect') && redirect_load_by_source($redirect_source)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment