Welcome Guest, Not a member yet? Register   Sign In
Create CI4 project in sub folder
#9

(04-09-2020, 09:38 AM)jean5769 Wrote: Hi !  Smile

I did several research about this subject, but I didn't find a solution.

I have a a domain who contains several projects. For example, I have something like this : Each project has a new folder (it'is a website used for development experimentation).

Now, I have tried to create a CI4 project inside a folder, like my other projects. So I put my CI4 folder (with /public, /app, /writable, etc.) inside a folder like : I want to access my project from this URL, without the index.php and without the /public folder in the URL.

I think I need to create a .htaccess file at the root of the project to redirect to the /public folder (and to adapt the .htaccess file inside the /public folder), but I can't get it to work...

If I don't have a .htacces in my CI4 root folder, I have a 403 Forbidden message, and if I create a .htaccess file, I always have a 500 error.

Someone knows how to do that ?

Thanks a lot ! Big Grin


I might be late to answer this, Imma playing with CI4 recently, was stuck with the same problem and got the initial solution for the same, You do not have to change anything in the .htaccess file inside the public folder, all you have to do is create a new htaccess in root and paste the below code

Code:
#installpl is my subfolder
DirectoryIndex /installpl/public/index.php 
RewriteEngine on
RewriteBase /installpl
RewriteCond $1 !^(index\.php|images|assets|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./public/index.php/$1 [L,QSA]
Reply


Messages In This Thread
Create CI4 project in sub folder - by jean5769 - 04-09-2020, 09:38 AM
RE: Create CI4 project in sub folder - by dodbda - 04-09-2020, 12:53 PM
RE: Create CI4 project in sub folder - by meta - 06-04-2020, 03:56 PM
RE: Create CI4 project in sub folder - by meta - 06-05-2020, 07:54 AM
RE: Create CI4 project in sub folder - by SubrataJ - 03-17-2022, 01:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB