Krusade — homeKrusade
BlogContact
© 2026 Krusade LLCcontact@krusade.com
  • Privacy
  • Terms
  1. Home
  2. /
  3. Blog

Setting up Wordpress Multisite on Railway

November 10, 2025

Setting up Wordpress Multisite on Railway

define('DOMAIN_CURRENT_SITE','${{RAILWAY_PUBLIC_DOMAIN}}');
define('WP_HOME','https://${{RAILWAY_PUBLIC_DOMAIN}}');
define('WP_SITEURL','https://${{RAILWAY_PUBLIC_DOMAIN}}');
define('WP_ALLOW_MULTISITE', true );"

Enable Network Setup in WordPress Admin Dashboard

  1. Go to Tools > Network Setup in your WordPress Admin Dashboard.
  2. Select Sub-directories option and click Install.

Update WORDPRESS_CONFIG_EXTRA to add below lines in addition to the existing lines

define('DOMAIN_CURRENT_SITE','${{RAILWAY_PUBLIC_DOMAIN}}');
define('WP_HOME','https://${{RAILWAY_PUBLIC_DOMAIN}}');
define('WP_SITEURL','https://${{RAILWAY_PUBLIC_DOMAIN}}');
define('WP_ALLOW_MULTISITE', true );
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

Final config should look like below -

Update .htaccess file to add below

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

In Railway, this can be done by updating the Custom Start Command to below -

/bin/bash -c "echo 'ServerName 0.0.0.0' >> /etc/apache2/apache2.conf && echo 'DirectoryIndex index.php index.html' >> /etc/apache2/apache2.conf && echo 'upload_max_filesize = 50M' >> /usr/local/etc/php/php.ini && echo 'post_max_size = 50M' >> /usr/local/etc/php/php.ini && rm /var/www/html/.htaccess && echo 'RewriteEngine On' >> /var/www/html/.htaccess && echo 'RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]' >> /var/www/html/.htaccess && echo 'RewriteBase /' >> /var/www/html/.htaccess && echo 'RewriteRule ^index\.php$ - [L]' >> /var/www/html/.htaccess && echo 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ \$1wp-admin/ [R=301,L]' >> /var/www/html/.htaccess && echo 'RewriteCond %{REQUEST_FILENAME} -f [OR]' >> /var/www/html/.htaccess && echo 'RewriteCond %{REQUEST_FILENAME} -d' >> /var/www/html/.htaccess && echo 'RewriteRule ^ - [L]' >> /var/www/html/.htaccess && echo 'RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) \$2 [L]' >> /var/www/html/.htaccess && echo 'RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ \$2 [L]' >> /var/www/html/.htaccess && echo 'RewriteRule . index.php [L]' >> /var/www/html/.htaccess && docker-entrypoint.sh apache2-foreground"

And redeploy the project.

Login to wp-admin

Related

Configuring Ghost blog platform to use AWS SES for email delivery

Configuring Ghost blog platform to use AWS SES for email delivery