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

Desktopserver本地localhost报404错误,无法访问WordPress站点求原因

Hey there, let's break down possible reasons and fixes for that 404 error when accessing your local WordPress site via DesktopServer—since restarting XAMPP and the database didn't do the trick, let's dig deeper:

Troubleshooting 404 Errors for Local WordPress Sites on DesktopServer
  • Check Your Site's Permalink Settings
    Permalinks often get messed up after server restarts or configuration shifts. Try accessing your WordPress admin directly via localhost/your-site/wp-admin (if the front end throws a 404). Once logged in, head to Settings > Permalinks, pick any option except "Plain" (like "Post Name"), and click "Save Changes". This refreshes the .htaccess file that handles URL routing for your site.

  • Verify DesktopServer's Site Configuration
    Open DesktopServer and confirm your site is marked as "Running". Double-check the local domain (e.g., yoursite.local) matches exactly what you're typing in the browser. Sometimes DesktopServer fails to register a site properly during setup—try stopping and restarting just that specific site within DesktopServer (not just the global XAMPP services).

  • Check .htaccess File Permissions and Content
    Navigate to your site's root folder (usually in C:\xampp\htdocs\your-site or DesktopServer's dedicated sites directory). Make sure the .htaccess file exists and has the correct WordPress rewrite rules. If it's missing, create a new file with this content:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /your-site/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /your-site/index.php [L]
    </IfModule>
    # END WordPress
    

    Replace /your-site/ with your actual site's subdirectory (or use / if it's the root site). Also, ensure the file has read/write permissions for the server user.

  • Confirm Apache's Mod_Rewrite is Enabled
    DesktopServer depends on Apache's mod_rewrite module for pretty permalinks. Open XAMPP's Apache config file (httpd.conf), search for mod_rewrite.so, and make sure the line isn't commented out (remove the # at the start if it is). Restart Apache after making this change.

  • Check Hosts File Entries
    For custom local domains like yoursite.local, your computer needs to map that domain to 127.0.0.1. Open your hosts file:

    • Windows: C:\Windows\System32\drivers\etc\hosts
    • macOS/Linux: /etc/hosts
      Ensure there's a line like:
    127.0.0.1 yoursite.local
    

    If it's missing, add it (you might need admin rights to save), then flush your DNS cache: run ipconfig /flushdns on Windows, or sudo dscacheutil -flushcache on macOS.

  • Test for Conflicting Plugins/Themes
    A misbehaving plugin or theme can break URL routing. Rename the plugins folder in your site's wp-content directory to plugins-disabled—if the site loads, you know a plugin is the issue. Enable them one by one to find the culprit. Do the same for the themes folder (rename to themes-disabled and switch to a default theme like Twenty Twenty-Four via wp-admin if you can access it).


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 08:36:41