Install CodeIgniter 4 on shared hosting |
Hi everybody, I'm new to programming with CodeIgniter and am having trouble installing it in a production environment on shared hosting. I know the subject has been dealt with on other posts but still have not found a solution.
I'm trying to install the news sample app used on the CodeIgniter tutorial. I own the domain jordivid.com, where I'm building a portfolio. My root folder is /usr/home/jordivid.me, and documents are placed under /web folder, here I have files for my site and some folders where subdomains are located, the /test folder holds the sample app. So I created the subdomain test.jordivid.com to test a production install that points to the physical folder /usr/home/jordivid.me/web/test/. After investigating the way to install the app in production here's what did:
... database.default.hostname = test.jordivid.me
"AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace." After reading the thread https://forum.codeigniter.com/thread-759...ed+hosting I made a the folder /test.jordivid.me one level up from /test and changed the $pathsPath var to: $pathsPath = FCPATH . '../test.jordivid.me/app/Config/Paths.php'; The result is the same. I must be doing something wrong or either there's some step I've left. My guess is that I should modify the .htaccess file, which currently is that in the tutorial unmodified, but after looking for some info on it I don't find the solution. Could anyone please help?
The easy way
Don't move content from /public to /test. Set document root for the test.jordivid.com domain as /usr/home/jordivid.me/web/test/public
Thanks for your answer, I did that.
Unfortunately the result is the same, I keep getting "AH00124: Request exceeded the limit of 10 internal redirects ...." when trying any route.
It's there, it's the .htaccess unmodified that comes with CI when installed with composer, that is:
Options All -Indexes <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA] RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] </IfModule> <IfModule !mod_rewrite.c> ErrorDocument 404 index.php </IfModule> My guess is that the solution would be a rule in .htaccess. In development I use XAMMP, I have set up a virtual host whose document root points to /public folder, just as in production the subdomain points to that folder too, in development the app runs ok, so I think the problem is in the server config. But I have not found which rule I could use in this case.
As an experiment, can you create a subdomain outside the web directory and install clean CI there?
It is not possible, that is the root folder for the hosting. When I create a subdomain it is placed under jordivid.me/web folder.
Finally I've found the solution. Now .htaccess is like this:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] </IfModule> I had the idea to use same settings that a couple Laravel apps on other subdomains are using, since the operations they do are similar, and it works. Now the problem is I can't access database, but if I cant't solve that I guess it would be a subject for another thread. Thanks for your help. |
Welcome Guest, Not a member yet? Register Sign In |