Using subdomain without multisite setup help

Hello. I am trying to setup my site on a sub domain folder. The site is not a multi site. I can get the site to work if I use the address:

However, that obviously means that shows all the root files (composer.json, web folder, config folder etc). I used these rules in my env file:

That let me get the site working if I view the web folder but not what I want. I want it to run so that you don’t see the root folder and from the front end perspective “web” folder is basically invisible. I hope that makes sense. I tried changing to:

But that showed the site with missing stylesheets etc. I’m sure there is a htacess rule I could use but I’ve been searching and cannot find how this is possible.

Please help.

You’d configure this outside of bedrock: Bedrock doesn’t know anything about server level routing, which is what you need to do here. Using whatever system you use to associate a domain with a web root, you need to associate a subdomain with the bedrock web root.

1 Like

Thank you. I found this video How to Deploy WordPress with Bedrock to Shared Hosting - YouTube which let me know that if I add the following into the sub domain root folder that it all works nicely.

`#this is for subdirectory

RewriteEngine On
RewriteCond %{HTTP_HOST} ^$ [NC,OR]
RewriteCond %{HTTP_HOST} ^$
RewriteCond %{REQUEST_URI} !web/
RewriteRule (.*) /web/$1 [L]

BEGIN WordPress

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

END WordPress`

And then in env changed back to WP_HOME=‘’. All working now.

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.