You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

安装XAMPP后访问htdocs文件遇404错误,请求技术支持

Troubleshooting 404 "Object Not Found" Error After Login in XAMPP Localhost

Let’s break down the most common fixes for this issue—since you can access index.php and phpMyAdmin, the core XAMPP setup is working, so the problem is likely tied to your login redirect or file structure.

  • Verify the login target file exists and paths are correct
    First, check where your login form is sending the request. Open your index.php and look for the <form> tag's action attribute (e.g., <form action="dashboard.php" method="POST">), or any server-side redirect code like header("Location: dashboard.php");.

    • Make sure the target file (like dashboard.php) actually exists in your htdocs directory (or the correct subdirectory if specified). If it's in a folder like admin/dashboard.php, confirm the folder and file both exist.
    • Use absolute paths with a leading slash (e.g., /dashboard.php) instead of relative paths if you're dealing with subdirectories—this ensures Apache looks from the root htdocs folder every time.
  • Double-check Apache's DocumentRoot configuration
    Sometimes the default htdocs path might have been altered. Here's how to confirm:

    1. Open the XAMPP Control Panel, click "Config" next to Apache, then select httpd.conf.
    2. Search for the lines starting with DocumentRoot and <Directory>. They should both point to your XAMPP htdocs folder (e.g., DocumentRoot "C:/xampp/htdocs" and <Directory "C:/xampp/htdocs">).
    3. If they're pointing elsewhere, update them to the correct htdocs path, save the file, and restart Apache.
  • Rule out .htaccess issues
    If your project uses an .htaccess file for URL rewriting, incorrect rules could be redirecting to a non-existent page. Try temporarily renaming the file to .htaccess.bak, then test the login again. If the 404 goes away, you’ll need to debug the rewrite rules in the original .htaccess file.

  • Check file permissions

    • On Windows: Right-click the target file/folder, go to "Properties", and uncheck the "Read-only" box if it’s selected.
    • On macOS/Linux: Open a terminal, navigate to your htdocs directory, and run sudo chmod -R 755 . to grant Apache read access to all files and folders.
  • Watch out for case sensitivity (macOS/Linux)
    Unlike Windows, macOS and Linux treat filenames as case-sensitive. If your code redirects to Dashboard.php but the actual file is named dashboard.php, this will trigger a 404. Double-check that the case in your code matches the actual file name.

  • Restart Apache
    Sometimes cached configurations or file locks can cause odd issues. Simply stop and start the Apache service in the XAMPP Control Panel, then try logging in again.

内容的提问来源于stack exchange,提问作者varma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:37:09