Welcome Guest, Not a member yet? Register   Sign In
How to run codeigniter4 in shared hosting ?
#3

(03-24-2020, 10:53 AM)Ithinkscaptain-sensible Wrote: well not only do i have shared hosting but i also am using domains via "add on domains" and " sub domains"  as part of my hosting.



I have a web up using CI4 but won't paste the url since i had a previous post deleted ,which i assumed was due to some sort of ban on promoting webs.

Anyway there was not that  much to do really.  In my control panel for hosting there is an option to set the "document root ". When i look at my hosting and directories, generally the document  root is the same as the  directory name.

But with CI4 because the bootstrap index.php is inside the "public" directory of your app; you need to set the
document root of your domain to domain/public

For App.php located at app/Config/App.php  you need to set the base url (line 24 of APP.php) to your domain.

eg on my local host is was :
public $baseURL = 'http://127.0.0.2';

so i changed  it to:

public $baseUrl= 'http://myDomainName.com';


Then the next issue is moving from http to https


For that i changed :
public $baseUrl= 'http://myDomainName.com';

to : $baseUrl= 'https://myDomainName.com';

then in the .htaccess file located in public directory I changed :
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

to:

RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]

Now on my hosting they have a "Lets Encrypt" facility
So i basically set up SSL using lets Encrypt and found  every thing worked.When i looked at the .htaccess file i noted "lets Encrypt" had done some over writing .

BAsically to go from localhost to live thats all i did

But I think this is not the solution. What if I want to do it in my main domain? Every hosting provider does not provides SSH access.
Reply


Messages In This Thread
RE: How to run codeigniter4 in shared hosting ? - by shahadathossain - 03-24-2020, 11:17 AM
RE: How to run codeigniter4 in shared hosting ? - by bitshifter - 03-24-2020, 03:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB