0

On a test server, I've installed a new multisite instance. It lives in /var/www/html/m (m=multisite). I've attempted to set up the first site and have given it a path of http://server/m/a.

However, when I attempt to visit this url, I receive a 404: "Not Found.The requested URL /m/a was not found on this server."

I've set up the .htaccess file in /var/www/html/m/ as recommended from the admin panel. The vhost file is as follows?

<VirtualHost *:80>
      DocumentRoot /var/www/html
</VirtualHost>

<Directory /var/www/html>
    AllowOverride All
</Directory>

Do I need to include a separate Directory entry for /var/www/html/m? Or will this directive propagate?

1
  • Don't forget to set up a default <VirtualHost> directive to catch any requests that don't go to any of your sites. Otherwise any request will be diverted to your first <VirtualHost> directive: Apache 2.2 Manual - Virtual Host Examples Apr 1, 2014 at 1:04

1 Answer 1

0

Actually, There is no need for setup the VirtualHost in your server.

Multisite have two way for visiting, base on subpath and subdomain.

You choose the subpath, So the server don't need to do anything. Just make sure your apache server support the rewrite.

then add the .htaccess content as the below. It's for the sub-path.

RewriteEngine On  
RewriteBase /m/  
RewriteRule ^index\.php$ - [L]  

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]  

Then you should add some config content into you wp-config.php then relog in.

define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'youdomian.com');
define('PATH_CURRENT_SITE', '/m/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Then you should visit the site a by server/m/a, Check you .htaccess and wp-config.php, watch the line " RewriteBase /m/" and "define('PATH_CURRENT_SITE', '/m/');"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.