You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your project folder is not a subfolder of the Apache document root, then your
130
130
<VirtualHost> element may need a nested <Directory> element to grant the web server access to the files.
131
131
132
+
With mod_userdir (shared hosts)
133
+
--------------------------------
134
+
135
+
A common practice in shared hosting environments is to use the Apache module "mod_userdir" to enable per-user Virtual Hosts automatically. Additional configuration is required to allow CodeIgniter4 to be run from these per-user directories.
136
+
137
+
The following assumes that the server is already configured for mod_userdir. A guide to enabling this module is available `in the Apache documentation <https://httpd.apache.org/docs/2.4/howto/public_html.html>`_.
138
+
139
+
Because CodeIgniter4 expects the server to find the framework front controller at ``/public/index.php`` by default, you must specify this location as an alternative to search for the request (even if CodeIgniter4 is installed within the per-user web directory).
140
+
141
+
The default user web directory ``~/public_html`` is specified by the ``UserDir`` directive, typically in ``/apache2/mods-available/userdir.conf`` or ``/apache2/conf/extra/httpd-userdir.conf``::
142
+
143
+
UserDir public_html
144
+
145
+
So you will need to configure Apache to look for CodeIgniter's public directory first before trying to serve the default::
146
+
147
+
UserDir "public_html/public" "public_html"
148
+
149
+
Be sure to specify options and permissions for the CodeIgniter public directory as well. A ``userdir.conf`` might look like::
0 commit comments