• I would like to setup the following scenario using Multisite, but have been unable to find a setup process on it.

    WordPress setup at primary: domain.tld
    Multisite activated to allow subdomains: sub.domain.tld
    Visitors receive domain.tld with registration page when attempting to visit a non-existent site (standard setup).

    Non-WordPress related subdomains utilized for outside services: support.domain.tld

    This is to allow me to use third-party tools or dedicated sites which are not using WordPress.

    I am using a dedicated IP and CPanel. I have tried various scenarios, but to no avail such as:

    Created wildcard * in CPanel, pointing to main WordPress install. Created support. subdomain and pointed to appropriate folder (outside main WordPress install). Verified DNS zone was properly populated with support listed before * for A records. — This sometimes redirected properly, but was very random for release prior to 3.5.

    Can anyone point me in the right direction for this type of setup? I am looking to have a few subdomains setup for various services outside of WordPress, but cannot seem to get it working properly.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I would setup the NON WP subdomains first, as named subdomains, and then do WordPress. It should work jyst fine. WP will ignore any ‘real’ subdomains.

    Thread Starter Anthony Gorss

    (@anthonyg70)

    I had tried that in the past, but the .htaccess created by WP causes the subdomains to be invalid and all traffic directed to the primary WP site. Any time I would type in sub.domain.tld for a custom subdomain I had created in CPanel it would always redirect to a registration page for WordPress showing domain was eligible for registration.

    A bit of digging, some review of my past notes, I figured it out ?? Here is the solution for those interested.

    • Created a subfolder under the main www directory; wordpress
    • Installed WordPress into that folder
    • Followed the directions for installation per WordPress normal installation.
    • Followed directions to use a separate directory: https://codex.www.ads-software.com/Giving_WordPress_Its_Own_Directory
    • Followed directions for Network Setup: https://codex.www.ads-software.com/Create_A_Network
    • Copied .htaccess and index.php over to main www folder, one below the current /wordpress folder.
      .htaccess should look like the following, bold sections your custom WP subdirectory:

      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.php$ - [L]
      
      # add a trailing slash to /wp-admin
      RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
      
      RewriteCond %{REQUEST_FILENAME} -f [OR]
      RewriteCond %{REQUEST_FILENAME} -d
      RewriteRule ^ - [L]
      RewriteRule ^(wp-(content|admin|includes).*) wordpress/$1 [L]
      RewriteRule ^(.*\.php)$ wordpress/$1 [L]
      RewriteRule . index.php [L]
    • Copied over index.php from the WordPress installation directory. Had to edit a line as it was pointing to wrong location; even though defined as custom subdirectory in WP.
      /** Loads the WordPress Environment and Template */
      require('./wordpress/wp-blog-header.php');
    • Created wildcard subdomain in Cpanel to redirect to root www folder so WordPress can take care of processing.

    Now I can use subdomain creation, via CPanel, to create any subdomain with proper resolution as it’s handled by Apache before WordPress and is not redirected by WordPress .htaccess. This also alleviates changing .htaccess at the root www level with any special alterations. Any non-existent subdomains show as available for registration in WordPress Multisite as normal and my custom subs work as intended with folders outside the WordPress installation.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I had tried that in the past, but the .htaccess created by WP causes the subdomains to be invalid and all traffic directed to the primary WP site.

    No, not really. The .htaccess isn’t what redirects traffic.

    It’s cpanel. You should have had the same problem wether or not you had the .htaccess.

    Thread Starter Anthony Gorss

    (@anthonyg70)

    I guess I should have been a bit more clear on the configuration, although using the above is working.

    I have the main WordPress domain set under /var/www/wordpress with a .htaccess redirect to push www to non-www, and other traffic to /wordpress folder.
    I have a support domain, which is under /var/www/support and subdomain redirect works fine.
    I have a yourls installation at /var/www/yourls and subdomain works fine.

    Here is where I was having the hangup. Yourls is set to use a redirect for domain.tld/randomsomething, not yourls.domain.tld/rndm as that would defeat the purpose of a short url. I could access the interface for yourls, although use of a generated short domain led WP showing a 404 error as the page was not found. Occasionally I would also have the subdomain enabled multisite hiccup and tell the user the domain (support/yourls) was available for registration.

    The primary goal was to setup subdomains to resolve properly, which a normal install would probably handle fine. Using the domain shortener on the primary domain in addition to WordPress didn’t work as I thought it would originally. The domain shortener was for WP and to allow guests to shorten outside links using the domain.tld. If a short url doesn’t exist (typo, expired, etc), the user is presented with the main page of my WordPress Multisite, which has a mention about short urls available. Better than redirecting to a blank page or 404 no?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I have the main WordPress domain set under /var/www/wordpress with a .htaccess redirect to push www to non-www, and other traffic to /wordpress folder.

    So … if I went to domain.com I would get data from /var/www/wordpress ? Like you did the ‘having WordPress in it’s own directory’?

    FWIW, having WP Multisite run out of a folder OTHER than where it was installed did not work prior to 3.5.1, so anything you did to make that work was very customized.

    Your setup structure is a bit odd, but … here’s a working example:

    WordPress is installed in /home/public_html/
    It’s URL is domain.com

    Yourls is installed in /home/public_html/you.rls/ as an AddOn Domain, which means it has it’s own entry in my httpd.conf to tell everyone where to go.
    It’s URL is you.rls

    Subdomains off domain.com work just fine.

    So long as I never name a page, post or sub-site ‘you.rls’ everything works exactly as expected.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Non-WordPress Subdomains WordPress Multisite’ is closed to new replies.