Welcome Guest, Not a member yet? Register   Sign In
Can't get rid of routing to "public"
#1

(This post was last modified: 03-15-2023, 02:06 PM by Tbronson.)

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?
Reply
#2

It seems your web server config is wrong.
Reply
#3

(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.
==

Donatas G.
Reply
#4

@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
Reply
#5

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.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB