For those who use Bedrock WordPress boilerplate or someone who plans to modify their web root directory, this post will be handy.
Changing Document Root is fairly easy if you’re using Hestia Panel but it’s a nightmare for those who are using Shared Hosting or cPanels, especially when the domain is set to primary domain.
The solution is simple. Just add the following directives in the .htaccess file from your root directory and it works.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteCond %{REQUEST_URI} !your/custom-dir/
RewriteRule (.*) /your/custom-dir/$1 [L]
Read my previous post similar to this one here.
I hope this helps. Let me know in the comment below if you guys have any thoughts.