Setup WordPress Subdomains (for Multi-Site) manually [-]

(p.s. UPDATE : this method doesnt work correctly at this moment)

 

When your hosting doesnt support WildCard subdomains, you can use this method:

 

Manually create this file /subdomain/index.php with this content:

<?php require_once( __dir__ . '/../index.php' ); ?>

 

and /subdomain/wp-admin/index.php with this content:

<?php require_once( __dir__ . '/../wp-admin/index.php' ); ?>

and /subdomain/.htaccess with this content (just change example.com ):

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*?)$ http://example.com/$1 [L,R] 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).*) $1 [L] RewriteRule ^(.*\.php)$ $1 [L] RewriteRule . index.php [L] </IfModule>

Note, that the only drawback of this code, is that it redirects all urls (not found files at subdomain) to root domain url, instead of rewriting.. I mean, if you visit subdomain.example.com/myfile.jpg it redirects to example.com/myfile.jpg.

Leave a Comment

Your email address will not be published. Required fields are marked *

Puvox - Blog
Scroll to Top