I'm using xampp in Windows 10 to run slimframework that calls API when logging in.
If I type the localhost/maps.html, the site can be accessed but if I try to click the login button in index.html, the Login API is not called.
I already configured the httpd
and httpd-vhosts
, the site can be accessed locally but whenever I tried clicking the login button in index.html, this error message appeared:
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
localhost
Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.7
Here is what my directory structure looks like:
Under root folder:
-index.php
-maps.html
-index.html
-admin/
-js/
-vendor/
-.htaccess
Inside index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Maps</title>
<script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/knockout/knockout-3.0.0.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/login.js"></script>
<script type="text/javascript" src="js/lib/jquery.cookie.js"></script>
<link rel="icon" href="favicon.ico" />
</head>
<body>
<div id="header">
<h1 data-bind="text:site_title"></h1>
</div>
<div id="login_container">
<div id="login_view">
<div>
<input id="loginid" type="text" data-bind="value: loginid, event:{keypress:kpLoginId}" placeholder="LoginID" />
</div>
<div>
<input id="password" type="password" data-bind="value: password, event:{keypress:kpPassword}" placeholder="Password" />
</div>
<div>
<button id="login" data-bind="click: login">Login</button>
</div>
</div>
</div>
<div data-bind="visible: failed">
Cannot Login
</div>
</body>
</html>
Inside httpd.conf:
DocumentRoot "C:xampphtdocsmyslimsiteweb_src"
<Directory "C:xampphtdocsmyslimsiteweb_src">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.html index.php index.pl index.cgi index.asp index.shtml index.htm
default.php default.pl default.cgi default.asp default.shtml default.html default.htm
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>
Inside .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/api/v1/(.*)$ /index.php/$1 [QSA,L]
Is there any additional setup that needs to be configured aside from httpd.conf and httpd-vhosts.conf to make the other page work? Thank you.
question from:
https://stackoverflow.com/questions/65914153/xampp-error-404-object-not-found-the-requested-url-was-not-found-on-this-serve 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…