I've been trying to deploy my codeigniter 4 app into a local apache server.
I want to be able to access my app through http://localhost/my_app/.
I've set up the url in the .env file:
app.baseURL = 'http://localhost/my_app'
Edited the .htaccess inside the public/ folder
RewriteBase /public/
And created the config for apache
<Directory "/var/www/html/my_app/public">
AllowOverride all
LogLevel debug
</Directory>
Alias /my_app /var/www/html/my_app/public
I can access the home page http://localhost/my_app, but when I try to go to another page http://localhost/my_app/bootstrapview, apache can't find the url.
"The requested URL was not found on this server."
Have I missed something to make it work? I don't want to change the position of the index.php file and it is most of the things I've found in my searching.
When I try it with the spark server, it works well.
Edit: I'm using Ubuntu 18.04 and mod_rewrite is enabled.
If I don't use RewriteBase, it keeps getting redirected:
redirected from r->uri = /my_app/public/index.php/public/index.php/public/index.php/public/index.php/public/index.php/bootstrapview
I have found some answers while checking out other options.
With this configuration, it will work if you change the RewriteBase to the URL of the app:
RewriteBase /my_app/
There is still a problem with redirections to the base URL "http://localhost/my_app/" in which apache will not find the base route (in Routes.php -> "/") but you can create another route to point to it ("/home") for example.