Description
During the creation of examples for my book on CI4 and tutorials to help the Brazilian community, I came across the need to configure the URL so that /public
is not displayed without changing the default framewoprk structure.
I created a .htaccess
file at the root of the application containing the following code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
When I use a virtual host (eg http://public-htaccess.test) this code in .htaccess
works normally, but if I get the same structure of the application using localhost (http://localhost/public-htaccess ) the code does not work correctly, says that the controller was not found, as he understands that the controller is public-htaccess
.
Could someone tell me if it is possible to do this redirection for the use case with localhost and how would it be the correct way within the framework standards?
The documentation in this regard is not clear, so if you can give me feedback on this issue, I can also supplement the documentation with this information.
OS: Win10
Apache: 2.4.41
PHP: 7.4.5
CodeIgniter: 4.0.3
P.S.: @lonnieezell and @samsonasik can you help me?
Activity