• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to install CI4 in sub folder in shared hosting?

#1
How to install CI4 in sub folder in shared hosting?
I want to access by this URL(without public folder):
example.com/myapp/controller/method ...
Reply

#2
You should set the "DocumentRoot" option in HTTPD.conf your server settings, Example:
DocumentRoot = "%siteDir%/myapp/public/"
Or if you renamed the "public" folder to "myapp", then install something like this:
DocumentRoot = "%siteDir%/myapp/"
Where %siteDir% points to a domain folder.
I would change this world, but God doesn't give me the source.
Reply

#3
(09-28-2019, 04:08 AM)Digital_Wolf Wrote: You should set the "DocumentRoot" option in HTTPD.conf your server settings, Example:
DocumentRoot = "%siteDir%/myapp/public/"
Or if you renamed the "public" folder to "myapp", then install something like this:
DocumentRoot = "%siteDir%/myapp/"
Where %siteDir% points to a domain folder.

As i mentioned the host is shared... and we cannot edit  HTTPD.conf...
The host root dir contains some Apps folders and one of them is CI4:
public_html/frameworkX/...
public_html/frameworkY/...
public_html/CI4/...

Now, we want make CI4 URL access without 'public', like:
example.com/CI4/controller/method ...
Reply

#4
Try doing it in a file .htaccess which will be located in the folder pointed to by your server, if you look at ci4/public/.htaccess it says that you can set the base directory using the parameter "RewriteBase", and also provides a link to the official documentation for configuring the server files.
I would change this world, but God doesn't give me the source.
Reply

#5
Finally i found a simple solution:
1- create index.php in the ci4 root folder that contain ( include 'public/index.php' )
2- then copy public/.htaccess to the root folder
Reply

#6
(09-28-2019, 11:58 PM)kingstyles Wrote: Finally i found a simple solution:
1- create index.php in the ci4 root folder that contain ( include 'public/index.php' )
2- then copy public/.htaccess to the root folder

You do not absolutely need a directory named "public". You can reorganize the directories like you want. You just need to have a public and a private directory. 

You can put all the content of the "public" directory anywhere you want, with the name you want, and then set the path for the private directory in index.php :
Code:
// Location of the Paths config file.
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath = FCPATH . '../my-ci4-webapp/app/Config/Paths.php';
// ^^^ Change this if you move your application folder
Test your translation files with Translation Tester
Reply

#7
(09-29-2019, 06:38 AM)includebeer Wrote:
(09-28-2019, 11:58 PM)kingstyles Wrote: Finally i found a simple solution:
1- create index.php in the ci4 root folder that contain ( include 'public/index.php' )
2- then copy public/.htaccess to the root folder

You do not absolutely need a directory named "public". You can reorganize the directories like you want. You just need to have a public and a private directory. 

You can put all the content of the "public" directory anywhere you want, with the name you want, and then set the path for the private directory in index.php :
Code:
// Location of the Paths config file.
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath = FCPATH . '../my-ci4-webapp/app/Config/Paths.php';
// ^^^ Change this if you move your application folder

Thanks alot
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.