Roots Discourse

Only site directories are showing and I suspect I need a working .htaccess file.. Anyone?

This is what I have in my root folder, and when I go to my url, this is what is showing and not my website. It is a wordpress site: https://drive.google.com/file/d/1AU6m_53U-nYANnRNUp6NLaCkfpzrfHPr/view?usp=sharing

Inside the folder ‘public_html’ is the index.php file. And if I click it I go to the site, but it looks like this:
https://drive.google.com/file/d/1uzRWVRUcttVK-bAunlv9tuy3fdZOJD8O/view?usp=sharing

And so I have a hunch that I need the correct .htaccess file in order to find the correct folders and files. Or am I wrong?

Some other details:

  • In the browser I use a ‘working-url’: new.mysite .com because the main url is routed to another webhost until we get the new site up and running. But the files are inside the root folder. (Not example .com/new)
  • I’ve set the siteurl to: https://example .com/wp
  • And homeurl to: https://mysite .com/

I’ve tried writing a .htaccess file like this, but getting the 500 internal error message:

#This is for subdirectory
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.mysite .com$
RewriteCond %{REQUEST_URO} !public_html/
RewriteRule (.*) /public_html/$1 [L]

#This is must
# BEGIN WordPress
<IfModule mod rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

I’ve tried a lot of things, but can’t seem to find the connecting dots. If someone out there with a clear head and more experience that could look into this, I would highly appreciated it.
Kind regards,

Have you read through the Bedrock docs? It looks like you’re missing step 4 (or it was done wrong) in the installation instructions: https://roots.io/docs/bedrock/master/installation/

Yes I did, but I changed the ‘web’ folder to ‘public_html’ because I couldn’t find a way to set the document root on my webserver to Bedrock’s web folder.

Try this.

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]

Hi, do you mean the .htaccess in root or the .htaccess inside the public_html folder? Should I replace your code with something specific? Thank you for helping out!

It goes in the “document root”, so in the “web” directory.
The trick to the .htaccess file working is that you have mod_rewrite enabled in apache.