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

本地Drupal站点搭建:导入数据库后访问出现404错误求助

Troubleshooting Drupal 404 on /user/login in Lando Local Environment
  • Verify Site Base URL & Trusted Hosts
    Open your settings.php file (usually in sites/default/) and confirm:

    • $settings['trusted_host_patterns'] includes your Lando domain (accesspoint.lndo.site). Example:
      $settings['trusted_host_patterns'] = [
        '^accesspoint\.lndo\.site$',
      ];
      
    • Ensure there’s no conflicting $settings['base_url'] override unless explicitly needed, and $config['system.site']['page.front'] is set correctly.
  • Clear Drupal Cache
    Refresh routes and configuration with Drush via Lando:

    lando drush cr
    

    This resolves most cases where cached routes from the imported database don’t match your local environment.

  • Check Rewrite Rules & Web Root Configuration

    • For Apache: Confirm the .htaccess file exists in your Drupal web root (typically web/) and matches the default Drupal version (unless you have custom rules).
    • For Nginx (common in Lando’s Drupal recipes): Ensure your .lando.yml has the correct webroot setting. Example:
      appserver:
        type: php:8.1
        webroot: web
        config:
          server: nginx
      
  • Validate Login Route Exists
    Check if the /user/login route is registered:

    lando drush routes:list | grep user/login
    

    If no results appear, enable the core user module if it’s disabled:

    lando drush pm:enable user -y
    
  • Enable Clean Permalinks
    Ensure clean URLs are active (required for core routes to function properly):

    lando drush config-set system.permalinks status 1 -y
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.19 12:01:04