Object not found in apache

I’m using manjaro and i installed mariadb, apache, php, php-apache, and phpmyadmin. if i request to /myUrl/api/ I got:

  "ok": false,
  "code": null,
  "message": null,
  "result": [

This result. But when i try with some exist methods for example /myUrl/api/login i got

Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404
Apache/2.4.56 (Unix) PHP/8.2.4

Here my .htaccess code

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

I tried to enable mod_rewrite and I uncommented #LoadModule rewrite_module modules/mod_rewrite.so in /etc/httpd/conf/httpd.conf and also I did sudo a2enmod rewrite and restarted httpd however result not changed. I’m new so please give detailed answer. Thanks

This just means that there is no file, folder, aliases or a rewrite by the name login. You need to make sure it is available, or apache will tell you that it can’t find it.

I’m sure there are login method and necessary files

There is a folder or file called login in a folder called api? Then please show the ls output of the folder api.

there’s folder called api but not file called login. Login is method in index.php. In api folder there are .htaccess and index.php

If your URL uses a / in front of login a file, folder, rewrite or alias is required. Get in touch with the developer of your API and ask what you need to do to use the login method. This is usually done by a request to the api with some payload or parameters in the URL.

look, i think problem on apache i have to do smth with it. coz i uploaded same code to hosting and i got result that i want

@foxdevuz , you need to configure your Apache to allow to apply settings in the .htaccess file of the directory where it is inside.
Otherwise the settings inside the .htaccess file are ignored…
Plus you need to allow overriding/enabling rewrites inside the .htaccess file via configuration settings inside the main Apache config…

Carefully examine the config of both Apache’s using the /server-info URL if you have it enabled, which i highly recommend (and needs to be protected for local access only or similar): mod_info - Apache HTTP Server Version 2.4

So unless you know exactly how to configure Apache, some things are best done inside the Apache main config instead of .htaccess files, because that needs extra permissions configured…

PS: I added the configuration tag to your thread :wink: