CodeIgniter Forums
Can't get rid of routing to "public" - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Can't get rid of routing to "public" (/showthread.php?tid=87115)



Can't get rid of routing to "public" - Tbronson - 03-15-2023

New installation of CI 4.3.2. with Bonfire 2. Trying to make this change to the home page URL

mysite.com/public TO mysite.com

Changed the document root to the "public" folder. Removed "public" from baseURL in .env and app/Config/App.php, leaving trailing slash.

Now, mysite.com gives a "404 Can't find a route for 'get: public'" error, and the URL in the browser address bar changes to mysite.com/public.

I've cleared every cache I can think of. Tried it in multiple browsers, on my Windows laptop and Android phone. 

These URLs work fine:

mysite.com/index.php // home page
mysite.com/admin // goes to Bonfire
mysite.com/home // I created a route to the "Home::index" in Routes.php

Exactly the same baseURL changes remove "public" no problem in another account in the same environment.

Any ideas?


RE: Can't get rid of routing to "public" - kenjis - 03-15-2023

It seems your web server config is wrong.


RE: Can't get rid of routing to "public" - dgvirtual - 05-11-2023

(03-15-2023, 10:12 AM)Tbronson Wrote: New installation of CI 4.3.2. with Bonfire 2. Trying to make this change to the home page URL

mysite.com/public TO mysite.com

Changed the document root to the "public" folder. Removed "public" from baseURL in .env and app/Config/App.php, leaving trailing slash.

Now, mysite.com gives a "404 Can't find a route for 'get: public'" error, and the URL in the browser address bar changes to mysite.com/public.

I've cleared every cache I can think of. Tried it in multiple browsers, on my Windows laptop and Android phone. 

These URLs work fine:

mysite.com/index.php // home page
mysite.com/admin // goes to Bonfire
mysite.com/home // I created a route to the "Home::index" in Routes.php

Exactly the same baseURL changes remove "public" no problem in another account in the same environment.

Any ideas?

I am not sure I understand what you did. What is the application structure now, and which directory on the server is accessed and which file is run when you open a browser at mysite.com? This does not make sense: "Removed "public" from baseURL in .env and app/Config/App.php, leaving trailing slash" - there is no "public" by default on $baseURL property in app/Config/App.php...

Anyway, in case you have not solved the problems yet: I have recently done some changes to Bonfire app links, so you may want to update the app and run it again.


RE: Can't get rid of routing to "public" - JanFromHamburg - 05-24-2023

@Tbronson Have you already found a solutions for yourself?
I have a similar problem. I use a subdomain, which points to the main folder and I can't get rid of the 'public' in the url.
Config/app $baseURL is the subdomain with trailing slash
public/htaccess: appstarter standard


RE: Can't get rid of routing to "public" - InsiteFX - 05-25-2023

Normal server:

root
-- app
--system
-- public ( or public_html )
---- assets
------ css
------ js
------ etc;
-- writable

Sub Domain:
root
-- app
--system
-- public ( or public_html )
---- assets
------ css
------ js
------ etc;
-- writable


I'am on shared hosting and this has always worked for me.

I just FTP everything up to my server in the root and it just runs.
My Hosting provider is Web Hosting Buzz
As for php version I have a CPanel dropdown to select any version of php.