Roots Discourse

Google Search Console is indexing config files

Hi,

We have put a Bedrock site to production and added all the usual analytics to the site.

We just received a Search Console issue regarding the config folder saying it’s getting a 500 error on the php config files:

example.com/config/environments/staging.php
example.com/config/environments/development.php

Should I just add a disallow rule in the robots.txt or is there a process with Bedrock to stop this?

This should never be the case as your public path for your web server should be set to web/ making config and more importantly, .env, not publicly viewable.

Please re-check your configuration.

Problem is that its hosted on WHM/cPanel and I haven’t found out how to change document root from public_html to public_html/web. I’ve searched and searched bout found no real solution to that.

Am currently having to use a .htaccess in public_html

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} $
    RewriteCond %{REQUEST_URI} !^/web/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /web/$1
    RewriteCond %{HTTP_HOST} $
    RewriteRule ^(/)?$ web/index.php [L]
</IfModule>

Actually scrap that - I finally found how to edit the document root…

Log in as root via SSH and edit

nano /var/cpanel/userdata/USERNAME/DOMAINNAME.COM