Codeigniter backend with vuejs frontend

My frontend is vue js and my backend is codeigniter 4, i don’t understand why is Cors being blocked

If you actually read the error message, you’d see that doesn’t exist.

Try uploading the file(s) again, and making sure your .htaccess (if you have one) is working correctly.


I don’t have a .htaccess. should I have one? what should be the content of it

No, you don’t need one.

But you do need your /user/login" file to be on the server


I do have it, but it is in a controller

Does Restful API not work here? Because I have verified that all the files are uploaded.

dir user does not exist on the server


it is inside the controllers folder on codeigniter

this button when clicked

does an XHR post to this location (but that address does not exist because there is no dir user either)

— 2 —
you are not calling user.php
but only user (without extension as far as I can see from my picture )

This system is only designed to work with GET and POST methods, because most websites only use those HTTP methods. Other methods, like PUT, DELETE and PATCH are not supported.


Ok Thank you. I think my website won’t work here



Besides, I see that your user.php starts with the uppercase letter User.php

and the files on the server are case-sensitive


I don’t think you need to worry about the folders or files not being present.

Most frameworks, which I assume includes CodeIgniter, don’t have separate files and folders for each URL. Instead, all URLs are captured by a single index.php, after which the framework code determines what page to show.

So why doesn’t your /user/login URL work? I see two issues:

  • The PHP file that’s supposed to be called by your site is in the public folder, not the main htdocs folder.
  • There is no .htaccess file to ensure that all unknown URLs are captured by the main index.php.

But you can forego this by trying to access the login page at this URL:

When I open that URL, I see a CodeIgniter error message. That means it’s hitting your framework code, which is progress.

As for why it’s crashing, I leave that up to you to investigate.

As for the URLs, I would suggest the following:

  • Place the .htaccess snippet from this article into a .htaccess file directly in the htdocs folder.
  • Place the .htaccess snippet from this article in a .htaccess file in the public folder within the htdocs folder.

These two .htaccess snippets should ensure that the URL should get rerouted to


Thanks for the help. it is currently accessing the codeigniter. but now it wont load the build files that I have added to it. Any idea why?

I have tried another approach with just adding the htaccess to the public folder and adjusted the axios call to “” from my understanding this should work but I am currently receiving a error message like this.

Can you confirm that your DB host settings are not localhost

and that the DB name matches the actual name (which are listed in the client area and control panel)

because this is what I see



I have checked it and the settings for the database where not matching, after matching them. it is still producing the same issue. The 500(Internal Server Error)

1 Like

What usually causes this 500 (Internal Server Error)?


Any other solutions I can try?