Welcome Guest, Not a member yet? Register   Sign In
No web server configuration
#1

Hello, I was wondering why there were no webserver configs,
a simple .htaccess config for apache would be really usefull.
Reply
#2

There is an .htaccess file: https://github.com/codeigniter4/CodeIgni.../.htaccess

Also, there is a whole section in the user guide dedicated to .htaccesshttps://codeigniter.com/user_guide/insta...g-htaccess
michalsn.dev - mostly about CodeIgniter
Reply
#3

Sorry, I was talking about the one in the root of the project, when you create a new codeigniter4 project there is no .htaccess in the root.
Every time I create a new project it replies with a 403 and I need to create that config file.

Reading the guide (that I totally missed) I see that the codeigniter team thinks that "It is not recommended that you place the project folder in the document root", may I ask why that is?
Thanks.
Reply
#4

quote : Sorry, I was talking about the one in the root of the project, when you create a new codeigniter4 project there is no .htaccess in the root.

a .htaccess file at root of CI4 web project its not needed to work with Apache in my experience . On linux the only things i look at are defining url to serve web app in /etc/hosts , correct permission for directories and files and use a virtualhost file ,which among other things defines that the place for apache to listen to http requests is the public directory
CMS CI4 A CMS system, runs out of the box written on top of CI4
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply
#5

(05-27-2025, 01:29 PM)Franky 5831 Wrote: I see that the codeigniter team thinks that "It is not recommended that you place the project folder in the document root", may I ask why that is?

To protect sensitive files. Only the public/ folder should be web-accessible. If .htaccess or server settings are misconfigured, core files (app, system, writable) could be exposed, creating security risks.
michalsn.dev - mostly about CodeIgniter
Reply
#6

(05-27-2025, 01:54 PM)captain-sensible Wrote: quote : Sorry, I was talking about the one in the root of the project, when you create a new codeigniter4 project there is no .htaccess in the root.

a .htaccess file at root of CI4  web project its not needed to work with Apache in my experience . On linux  the only  things i look at are  defining  url to serve web app  in    /etc/hosts  , correct permission for directories and files and  use a    virtualhost  file  ,which among other things defines that the  place for apache to listen to http requests is the public directory

Apache's default config doesn't do that, you have to manually edit it, that can be misconfigured too and in most projects it's not being tracked by git, on top of that if you need to deploy the same project among multiple servers (dev, testing, prod, prod-backup in some cases) you'll need to configure all those different apache configs, giving you more opportunities to misconfigure it.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB