CodeIgniter Forums
DOCUMENT ROOT - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: DOCUMENT ROOT (/showthread.php?tid=73929)



DOCUMENT ROOT - fogem - 06-25-2019

The hosting does not have access to the site configuration to change the "DOCUMENT ROOT". 
Can I get it back like it was?
In the root index.php .
What should I do?


RE: DOCUMENT ROOT - MGatner - 06-26-2019

I don't fully understand. Can you share an example of how you used to do this? Most framework paths are configurable via app/Config/Paths.php, and the index.php file is controlled by app/Config/App.php and public/.htaccess - those are places to start.


RE: DOCUMENT ROOT - fogem - 06-26-2019

(06-26-2019, 05:32 AM)MGatner Wrote: I don't fully understand. Can you share an example of how you used to do this? Most framework paths are configurable via app/Config/Paths.php, and the index.php file is controlled by app/Config/App.php and public/.htaccess - those are places to start.



RE: DOCUMENT ROOT - MGatner - 06-26-2019

You are serving out the root of the project, you should be serving public/ instead.
https://codeigniter4.github.io/CodeIgniter4/concepts/structure.html#public

Try (for example) changing this in your server config:
DocumentRoot /var/www/vhosts/dubleshop.com
to:
DocumentRoot /var/www/vhosts/dubleshop.com/public


RE: DOCUMENT ROOT - InsiteFX - 06-26-2019

Mine is set to public_html and CI 4 fines it with no problems


RE: DOCUMENT ROOT - Pehesis - 06-28-2019

(06-25-2019, 05:18 PM)fogem Wrote: The hosting does not have access to the site configuration to change the "DOCUMENT ROOT". 
Can I get it back like it was?
In the root index.php .
What should I do?

You could use a .htaccess file in the root to point to the /public/ folder

eg.
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.tld$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.tld$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]

so that when you visit yourdomain.tld it will read out of the public folder


RE: DOCUMENT ROOT - Paradinight - 06-28-2019

(06-28-2019, 03:57 PM)Pehesis Wrote:
(06-25-2019, 05:18 PM)fogem Wrote: The hosting does not have access to the site configuration to change the "DOCUMENT ROOT". 
Can I get it back like it was?
In the root index.php .
What should I do?

You could use a .htaccess file in the root to point to the /public/ folder

eg.
Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.tld$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.tld$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]

so that when you visit yourdomain.tld it will read out of the public folder

No. No. No.

Change the hoster or ask the hoster for help.