Forcing www on main domain (4 posts)

  1. michaelphill
    Posted 4 years ago #

    I have a WordPress Multisite install set up at a generic control panel domain, for example, http://www.controlpanel.com. We're then mapping full domains to the subdomains on to this without issue.

    I've already modified wp-config.php to force SSL for admin, but I'm having issues because, when in the admin panel, WordPress drops the "www," which of course causes an SSL mismatch.

    I'm able to get wp-login.php to show up on both www and non-www, but no matter which one is used, it redirects to the URL without www.

    How can I force the www within http://www.controlpanel.com/wp-admin?

    I've tried several .htaccess modifications and they either didn't do anything or didn't work at all.

    I tried modifying the wp_options table in the database so that the "siteurl" field is https://www.controlpanel.com, but that caused a redirect loop.

    Any other ideas?

  2. When you created your site, before activating Multisite, you can change your site and home URLs to www.domain.com - If you do that, and leave it alone, it'll keep the www.

    Otherwise, you have to treat it like 'moving wordpress'

  3. tjohare
    Posted 4 years ago #

    If I may, I've had similar issues and you might want to also add the following code to your .htaccess file to force URLs to resolve with the WWW or without it. (the example below is with the WWW)

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mysite.com
    RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]
    RewriteBase /

    For those individuals that link strings without the "www" in the URL, such as: http://mysite.com/portfolio, it will resolve the URL to "http://www.mysite.com/portfolio" cleanly.

  4. That doesn't help the back end though, tjohare :/ WP has it 'hard coded' in the DB in places, and just a .htaccess fix will cause an endless redirect.

Topic Closed

This topic has been closed to new replies.

About this Topic