How to run codeigniter4 in shared hosting ? |
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 |
Welcome Guest, Not a member yet? Register Sign In |