[Plugin: WordPress MU Domain Mapping] Domain mapping treats domains as case sensitive
In the function
redirect_to_mapped_domain, the plugin performs the following check:
if ( $url && $url != untrailingslashit( $protocol . $current_blog->domain . $current_blog->path ) )
The issue is that if a user enters the domain in anything but lower case, that check will fail (MyDomain.com != mydomain.com), so the plugin will redirect (in this case it will redirect to MyDomain.com). That redirect will then start over, because browsers treat all domains as lower case.
The two fixes I can think of would be either calling
strtolower()on all domains as they’re added to the database, or to use
strcasecmpin the comparison. The latter might be a little safer, because I’m not 100% that all browsers translate the case of a domain. So the fix would be:
if ( $url && 0 !== strcasecmp( $url, untrailingslashit( $protocol . $current_blog->domain . $current_blog->path ) ) )
That way the domain works no matter how then user enters it.
- The topic ‘[Plugin: WordPress MU Domain Mapping] Domain mapping treats domains as case sensitive’ is closed to new replies.