0

To keep this short, as a disclaimer, I'm not that versed with WordPress, servers, etc, so I might talk gibberish:

The Issue

🠺 I have a multisite root, let's call it msite.com

🠺 This site spawns temporary subsites with a random slug msite.com/random-code . This means I can't possibly know the slug beforehand

🠺 I also need to have on the server a folder with the random-site's slug name

(for example, on the server, the directory structure will be as follows: mysite.com/<random-code>)

🠺 The problem is, if there's a folder as the slug, the server throw's a 404 as it expects to reach an index.php in that folder and not be redirected to WordPress


What I found out

Well, looking at the generic .htaccess for a multisite, I realized this condition is the issue:

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

It basically blocks any attempt if there's an existing folder.

So naturally, I deleted it. Or more like made it

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

And it works fine ...

Alas, why it was there in the first place?

I want things to run smooth, so this probably causes an issue so I want to double-check if so and if there is a better solution

Also, a related question out of pure curiosity, how folders like wp-admin where able to bypass that rule

  • "if there's a folder as the slug, the server throw's a 404" - don't you mean a 403? – MrWhite Jun 12 '20 at 0:11
  • Well it was 404 written big in browser, I don't know the actual response code since i never looked at http response, but regardless, is it relevant? – Nertan Lucian Jun 12 '20 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.