Codeigniter backend with vuejs frontend

http://owcg.epizy.com/

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 http://owcg.epizy.com/user/login doesn’t exist.

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

6 Likes

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

4 Likes

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

3 Likes

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.

2 Likes

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

2 Likes

image

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

and the files on the server are case-sensitive

3 Likes

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: http://owcg.epizy.com/public/index.php/user/login

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 http://owcg.epizy.com/user/login should get rerouted to http://owcg.epizy.com/public/index.php/user/login.

5 Likes

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 “http://owcg.epizy.com/public/user” 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

2

https://www.codeigniter.com/user_guide/database/configuration.html

https://codeigniter4.github.io/CodeIgniter4/installation/running.html

5 Likes

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)?

4 Likes

Any other solutions I can try?