The MU forums have moved to WordPress.org

subdomains protected (2 posts)

  1. cmatera
    Member
    Posted 17 years ago #

    This is probably an easy thing to fix, but I need some help.

    I am running wordpress mu on a shared hostrocket server. I had hostrocket setup the virtual hosts/dns configuration necissary for me to create subdomains w/in wordpress mu. Here's where my mod_rewrite question comes in:

    I have certain subdomains that I am running other processes on...for example mailer.domain.org is my newsletter mailing program. it's located in my /home/domain/mailer subdirectory. dev.domain.org is my development area, and it's also located in /home/domain/dev subdirectory. I'm trying to create a mod_rewrite rule that will forward any http requests to mailer.domain.org etc to those specific subfolders. Here's what I have - which I culled from a forum.

    RewriteCond %{HTTP_HOST} !^(www\.)?knowmercy\.org$ [NC]
    RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.knowmercy\.org$ [NC]
    RewriteCond %{DOCUMENT_ROOT}/%2%{REQUEST_URI}/ -d
    RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteCond %{HTTP_HOST} !^(www\.)?knowmery\.org$ [NC]
    RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.knowmercy\.org$ [NC]
    RewriteRule ^(.*)$ /%2/$1 [QSA,L]

    It works for my mailing program, however it doesn't let me log into my calendar program (events.knowmercy.org/login.php) that forwards back to the knowmercy.org...I'm confused and in need of help.

    Thanks

    Chris Matera

  2. peiqinglong
    Member
    Posted 17 years ago #

    Actually you need to have your host make some changes to the httpd.conf file. The virtual host entry *.knowmercy.org should be after any other sub domain virtual host entries for knowmercy.org. For example:

    <VirtualHost {SERVER_IP_ADDRESS}>
    DocumentRoot /home/{CPANEL_USERNAME}/public_html
    BytesLog domlogs/{YOUR_DOMAIN}-bytes_log
    User {CPANEL_USERNAME}
    Group {CPANEL_USERNAME}
    ServerAlias knowmercy.org *.knowmercy.org
    ServerName http://www.knowmercy.org
    CustomLog domlogs/{YOUR_DOMAIN} combined
    </VirtualHost>

    should come after

    <VirtualHost {SERVER_IP_ADDRESS}>
    DocumentRoot /home/{CPANEL_USERNAME}/public_html
    BytesLog domlogs/{YOUR_DOMAIN}-bytes_log
    User {CPANEL_USERNAME}
    Group {CPANEL_USERNAME}
    ServerAlias dev.knowmercy.org
    ServerName http://www.knowmercy.org
    CustomLog domlogs/{YOUR_DOMAIN} combined
    </VirtualHost>

    and so forth. I know it sounds confusing, but basically if you have sub domains already created, the * is a catch all. So if the * appears before the entries of "events" and "dev" it assumes WPMU should take control. That's why it should be:

    "Events"
    "Dev"
    *

    Does that makes sense?

About this Topic

  • Started 17 years ago by cmatera
  • Latest reply from peiqinglong