I have converted my existing app to CodeIgniter and is working fully on my local.
I followed this article "Setup CodeIgniter " to setup the app in here. Updated the .env/baseUrl to correct settings. Under htdocs, I created .htaccess and added rule to rewrite .* to public as below:
RewriteRule (.*) /public/$1 [QSA,L]
Note that I have the .env, preload.php, spark under the htdocs just as the CI 4 template. Now, after this I was expecting the app to function; I am getting 403 instead. I noticed the article on 403 error talks about creating index.php but CI and the above article don’t seem to indicate I need one.
Help me out please as I don’t know what I am missing.
Your website seems to be working fine now, but it’s running behind Cloudflare so I’m not sure if the website is being hosted with us or somewhere else. Do you still need any help?
Yes, I do still need help. Currently, I see list of files/directories as I have the “Options +Indexes” in the .htaccess file. As soon I remove “Options +Indexes” it goes back to the 403 error. Need your help to find out why that 403 is coming up, perhaps in php_error.log on the server, which I can’t see.
With respect to hosting, yes, my nameservers are moved over to Cloudfare but files hosting is in here, and been this way for months now. It was all working before I my new version which is now built in CodeIgniter.
Yeah, with that option enabled, I can see the files/directories. I was expecting that adding “RewriteRule (.*) /public/$1 [QSA,L]” to .htaccess would root website root request of “/” to be routed to “/public” which doesn’t seem to be working?
I created an empty index.php and the 403 went away. So, that tells me that the .htaccess rule isn’t working. Can you help identify why is that and/or if rewrite module is enabled?
Update: I added RewriteEngine On, so it seems rewrite is working now, although some errors! Will let you know if I need help.