Support » Networking WordPress » subdomains on Multisite: htaccess & index.php settings

  • Resolved Beeblebrox-BSD

    (@beeblebrox-bsd)


    I’m preparing a Multisite where only sub-domains should be served by WordPress, while the domain its self should not. Specifically,

    • domain.com and http://www.domain.com should be served by contents of folder domain.com/main
    • *.domian.com (except www) to be served by folder domain.com/wordpress

    I need to write two separate rule-sets to make this happen and my problem is with the rule involving WordPress. Here’s what I have thus far:

    ## RULE-1 works
    <IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
       RewriteRule ^(.*)$ /main/$1 [L]
    </IfModule>
    
    # RULE-2 begin WordPress
    <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{HTTP_HOST} ^rs.domain.com$
        RewriteRule ^(.*)$ wordpress/$1 [L]
    </IfModule>
    # END WordPress

    With RULE-2, I’m able to get the hard-coded URL to show the main page (and without displaying the folder path). But I have problems:

    • No other path (like wp-admin) works, drops to “internal server error”
    • This being the simplified case, I need to write the RewriteCond for all subdomains, not just rs.
    • I’m concerned that Rewrite condition/rules for MultiSite are going to be a mess?
    • There’s no domian.com/index.php file as this breaks the domain.com/main site from working. Thus, I have not defined anywhere the necessary “require( dirname( __FILE__ ) . ‘/wordpress/wp-blog-header.php’ );” How should I do this in this instance?

    This is a fresh WordPress install, so no prior settings other than site-url set as rs.domain.com

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello

    Did you check the Wildcard in cpanel ?

    Did you check the Wildcard in cpanel ?

    Do you mean DNS records? If there were problems with that, rs.domain.com would not be able to resolve (which as stated it does)

    If you mean the site-url in the WordPress panel, the first step should be to get the simplified case of single sub-domain to work before the subsequnet steps of MultiSite?

    WildCard in Cpanel means to you have setup Subdomain as wildcard

    can you leave your URL here so i can check what exactly you are getting then i can help you in one short

    Thanks
    WPEMY

    Solved RULE-1. This means RULE-1 no longer breaks when I enable RULE-2.

    On to issue of “*.domain.com (except www) to be served by folder domain.com/wordpress”

    wpemy: Unless you have a better explanation, the problem has nothing to do with a *.domain.com DNS record.
    * MultiSite is not enabled yet. I posted in this sub-forum because I want this issue tracked in a single thread.
    * Records for rs.domain.com URL are obviously working, otherwise the browser would not reach the WP front page at all. sub-folders to the URL (like rs.domain.com/wp-admin/) have no relation to DNS (subdomain) records or http’s document_root.

    I now simplify the original question:
    WP Codex states two important steps for WP located in subfolder
    1. Modify index.php
    2. Modify .htaccess to subfolder path.

    Assuming all “*.domain.com” URL’s safely get passed to the domain.com/wordpress folder, how must the above 2 files be modified to get WP working properly? Single subdomain case first, and wildcard (all subdomains) case separately if possible please.

    Regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘subdomains on Multisite: htaccess & index.php settings’ is closed to new replies.