multisite: use a virtual subfolder for subblogs

For our school, we use a wordpress network. The main domain gives access to general information and sub-sites are specific projects managed by students.

I would like that all sub-sites have their url appended with a fake folder name.

example

Say the main domain is school.edu

My sub-sites are

school.edu/project1/
school.edu/project2/

I would like that it becomes:

school.edu/projects/project1/
school.edu/projects/project2/

How can i do it?

UPDATE 1

I tried adding this rule to my .htaccess. It redirects correctly, but then the displayed URL doesn’t stay the one i want, it reverts back to the original “real” url.

RewriteRule ^projects/([_0-9a-zA-Z-]+/)? $1 [R=301,L]

3 s
3

I had a similar issue with another client, entering something like projects/project1 would error as the / would fail validation.

After failing to find an override or filter, instead I found a loophole. If you make projectsproject1, then afterwards edit the site so its url is projects/project1 and save, update the homeurl etc, it works! You may need to make modifications to htaccess etc however to prevent attachments failing to load, but that should be less of an issue now that 3.5 skips ms-files.php

Leave a Comment