WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MU Domain Mapping
[resolved] Pointing no submain to WWW (5 posts)

  1. drokkon
    Member
    Posted 1 year ago #

    I have a problem getting people who type my domain without the www to get forced to my www subdomain.

    1. From my registrar, I have A records pointing multisite.com, site1.com and site2.com to my IP address.
    2. From my registrar, I have CNAME records pointing http://www.multisite.com, http://www.site1.com and http://www.site2.com to multisite.com, site1.com, and site2.com, respectively.
    3. In WHM, I have site1.com and site2.com parked on top of multisite.com
    4. In "Domain Settings" I have http://www.site1.com and http://www.site2.com pointed to their respective blogs.
    5. In .htaccess in public_html (my WordPress root), I have the following lines of code (in addition to the other code, including "RewriteEngine On"):
    rewriteCond %{HTTP_HOST} ^multisite.com [NC]
    rewriteRule ^(.*)$ http://www.multisite.com/$1 [R=301,L]
    rewriteCond %{HTTP_HOST} ^site1.com [NC]
    rewriteRule ^(.*)$ http://www.site1.com/$1 [R=301,L]
    rewriteCond %{HTTP_HOST} ^site2.com [NC]
    rewriteRule ^(.*)$ http://www.site2.com/$1 [R=301,L]

    Basically, this is working when someone types in "www.site1.com" or "www.site2.com." But I get weird behavior otherwise:

    1. Typing in just site1.com actually brings me to http://www.multisite.com for some reason.
    2. Typing in just site2.com gives me a cPanel/WHM "Default Website Page"

    Does anyone have any ideas where I'm going wrong? Thanks!

    PS: For what it's worth, the forum is automatically adding "http://" to anything that I prefix with www. Please note that I did not mean to add http anywhere, so I don't have "http://" typed into the domain settings or anything.

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

  2. Antonie Potgieter
    Member
    Posted 1 year ago #

    I'm having the same problem here.

    As a quickly solution, I added the domain twice under Settings > Domains. Once with and once without the 'www', both with the same site ID and that works.

    Problem is that the user will browse on the domain constantly that they entered the site with and this could cause problems with scripts and other things.

    If you have a solution here other than a hard redirect, please post back :)

  3. Antonie Potgieter
    Member
    Posted 1 year ago #

    I guess if you create 2 records under Settings > Domains with the same site ID, one with 'www' and one without 'www' and you make the one with the 'www' Primary and the one without the 'www' not primary, it will redirect as needed :) Try it out

    ID Domain Primary
    8 domain.com No
    8 http://www.domain.com Yes

  4. drokkon
    Member
    Posted 1 year ago #

    Thanks, Antonie. I should have mentioned that I tried that initially. It worked for site1.com (which was redirecting to http://www.multisite.com for some baffling reason), but not for site2.com, which is still pointing to a default CHM/cPanel page.

    I've traced both of these domains all the way back through the process and, as far as I can tell, they are set up identically!

  5. drokkon
    Member
    Posted 1 year ago #

    Well, domains are like that, aren't they? I gave it another day and it started working. How odd.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.