Can't get rid of routing to "public" |
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?
It seems your web server config is wrong.
It sounds like you have made the necessary changes to your document root and base URL, but you are still experiencing issues with accessing your home page at mysite.com.
Based on the error message you are receiving, it seems that there may be a configuration issue with your routes. Specifically, it appears that there is not a route defined for the "get: public" method. I would suggest checking your routes configuration file (usually located at app/Config/Routes.php) to ensure that there is a valid route defined for your home page. Double-check that the controller and method names match your desired setup. You may also want to try reordering your routes to ensure that the correct route is being matched first. Additionally, it's possible that there may be an issue with your server configuration or caching. You could try restarting your web server or clearing any server-side caches to ensure that your changes are being properly reflected. I hope this helps, and please let me know if you have any further questions or concerns. (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 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.
@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
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 )
While you have made the necessary changes to the document root and the baseURL configuration, you're facing a "404 Can't find a route for 'get: public'" error when accessing mysite.com. Additionally, the URL in the browser address bar still displays mysite.com/public despite the modifications you made.
Here are a few suggestions to help you troubleshoot the problem: Double-check your changes: Review the modifications you made to the document root and the baseURL in both the .env file and the app/Config/App.php file. Ensure that you have removed "public" from the baseURL and that you have included the trailing slash correctly. Verify server configuration: Confirm that the changes to the document root have been applied correctly on your server. Check the server configuration files (e.g., Apache's httpd.conf or Nginx's site configuration) to ensure that the document root is pointing to the correct folder. Clear cache and temporary files: Clearing the browser cache is a good step, but make sure you have cleared any server-side cache as well. If you are using any caching mechanisms like OpCode cache or a reverse proxy, clear those caches too. Check .htaccess file: Make sure your .htaccess file is properly configured to remove the "index.php" from the URLs. This file should be in the root folder of your CodeIgniter installation. Verify file/folder permissions: Ensure that the file and folder permissions are correctly set for your CI and Bonfire installation. The necessary files and directories should have appropriate read and execute permissions for the webserver. Investigate the routing: Check your routes configuration in the app/Config/Routes.php file. Verify that there are no conflicting or incorrect route definitions that might be causing the issue. Debugging and logging: Enable debugging mode in CodeIgniter's environment configuration (app/Config/ENVIRONMENT.php) to get more detailed error messages. Also, check the application logs to see if any errors or warnings are being logged. If you've gone through these steps and the issue persists, it might be helpful to consult the CodeIgniter and Bonfire communities for further assistance. Providing them with specific details about your environment, server configuration, and any relevant error logs will help them understand the issue better and provide targeted support. |
Welcome Guest, Not a member yet? Register Sign In |