WordPress Multisite development on PHP Built-In Webserver

I am trying to set up a development environment for WordPress multisite on my local MAC. I am developing using PHPStorm, and the built-in PHP webserver. One of the limitations of the built-in webserver is that is doesn’t support apache mod_rewrite, but instead uses routing scripts. However there’s very little clear documentation on translating into these from .htaccess rules.

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]

Is where I’m starting from, the basic WordPress redirect htaccess for a multisite with WordPress in its own directory (/wordpress)… can anyone point me in a good direction for resources on how to translate this into a routing script?

Related posts

1 comment

  1. So we finally managed to get this to work (at least using different domains for each site). Here is what it took:
    Add a line near the beginning of wp-config.php to detect the hostname and define a constant with it:

    define('APP_HOST', $_SERVER['HTTP_HOST']);
    

    Then make the following wp-config changes:

    /** URL to wp-content directory */
    define('WP_CONTENT_URL', 'http://' . APP_HOST . '/wp-content');
    
    /** Domain name of default WordPress website */
    define('DOMAIN_CURRENT_SITE', APP_HOST);
    

    (Note that our wp-content folder is seperate from our wordpress folder, our setup preference so we can update WP from git and not [that I know of] required.)

    From there it should “update” itself depending on whatever hostname your server is running under. The limitations we’ve found are that the built-in web server won’t run SSH (thus no SSH Admin), and that it doesn’t do the /wordpress/wp-admin redirect. So to get to wp-admin you need to use local.sitename.com/wordpress/wp-admin/ to get there. The trailing slash is important as well, as it won’t automatically add it.

Comments are closed.