Skip to content

Commit

Permalink
Merge pull request #99 from roborourke/master
Browse files Browse the repository at this point in the history
Fix subdirectory mangle_url rewrite
  • Loading branch information
roborourke committed Mar 14, 2018
2 parents 7f3846a + 70f1847 commit 320157a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mercator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Current version of Mercator.
*/
const VERSION = '1.0.1';
const VERSION = '1.0.2';

require __DIR__ . '/class-mapping.php';
require __DIR__ . '/class-network-mapping.php';
Expand Down Expand Up @@ -332,6 +332,7 @@ function mangle_url( $url, $path, $orig_scheme, $site_id = 0 ) {

// Replace the domain
$domain = parse_url( $url, PHP_URL_HOST );
$domain = rtrim( $domain . $current_mapping->get_site()->path, '/' );
$regex = '#^(\w+://)' . preg_quote( $domain, '#' ) . '#i';
$mangled = preg_replace( $regex, '${1}' . $current_mapping->get_domain(), $url );

Expand Down

0 comments on commit 320157a

Please sign in to comment.