WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MU Domain Mapping
[resolved] wordpress.com-like setup SSL problem (6 posts)

  1. meglio
    Member
    Posted 1 year ago #

    Hi Ron.

    First at all, here are our settings for the plugin:

    Domain Options
    + Remote Login
    + Permanent redirect (better for your blogger's pagerank)
    - User domain mapping page
    + Redirect administration pages to site's original domain
    - Disable primary domain check.

    Our setup is simple:

    * We use define('FORCE_SSL_ADMIN', true);

    * We follow the same approach as wordpress.com does regarding SSL certificate. We have one wildcard certificate *.example.com for our top domain where the WP network is insatlled (e.g. example.com).

    What we are trying to achieve: we want all user's admin areas and logins to happen under HTTPS, hence those settings mentioned above. We want front part of mapped domains (for children blogs) to be on HTTP (no ssl).

    What problem we are experiencing: everything is excellent except one thing. If our client logins to their admin area and then navigates to the front page, the links in the top admin bar are all for top-domain.com/wp-admin/etc.

    When clicking to such a link, I expect your plugin to redirect - and in fact it does it right. But before it can redirect, browser tries to open their top-domain.com/wp-admin/etc under HTTPS and our certificate does not cover all mapped domains, of course. So a terrible message like this is shown to the client: http://img191.imageshack.us/img191/9832/x9x.png

    Is there a way to configure your plugin in a way that at all times all admin links will always use sub-domain notation and never mapped-domain notation?

    So the goal is to let client freely navigate between his admin pages (sub-domain links) and front pages (mapped top level domain), without their browser even trying to open admin pages under a top level domain.

    In other words, I would like to have all navigation links in their admin panel to link to the sub-domain urls.

    Btw, if I'm authorized super-admin then the links are correct already, eg:

    My Sites -> Some Child Site -> Dashboard: this links to sub-domain notation.

    But after navigating to the child site mapped domain, all links in the admin dropdown menu (the black top bar) do not use sub-domain notation anymore.

    Any ideas?

    Regards,
    Anton

    http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/

  2. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 1 year ago #

    If you turn off remote login then the toolbar won't be shown on the front end. The remote login setting is essentially enabling the mapped domain admin links.

  3. meglio
    Member
    Posted 1 year ago #

    Thanks, Ron.
    I have turned off "remote login".
    But all items in the menu at the top of children websites still link to the mapped domain and not sub-domain:
    http://img834.imageshack.us/img834/3462/4of.png

  4. meglio
    Member
    Posted 1 year ago #

    Oh, Ron, and also it does not immediately redirect
    sub.network.com/wp-login.php
    to
    sub-network.com/wp-login.php

    It only redirects after the first login attempt.

  5. meglio
    Member
    Posted 1 year ago #

    Okay, I was able to solve the "early redirect" problem with an additional small plugin:

    /* Redirect all administration and login to sub-domains  */
    function datainserter_wp_redirect($location, $status = 'not interesting')
    {
    	if (!force_ssl_admin() || is_ssl())
    		return $location;
    
    	if (!function_exists('get_original_url'))
    		return $location;
    
    	if (strpos($_SERVER['REQUEST_URI'], 'wp-login.php') === false
    		&& strpos($_SERVER['REQUEST_URI'], 'wp-admin') === false)
    		return $location;
    
    	$originalHost = parse_url(get_original_url( 'siteurl' ), PHP_URL_HOST);
    	$locationHost = parse_url($location, PHP_URL_HOST);
    	$location = str_ireplace($locationHost, $originalHost, $location);
    	return $location;
    }
    
    add_filter('wp_redirect', 'datainserter_wp_redirect');
  6. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 1 year ago #

    Glad you found a solution.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic