本地Drupal站点搭建:导入数据库后访问出现404错误求助
Troubleshooting Drupal 404 on /user/login in Lando Local Environment
Verify Site Base URL & Trusted Hosts
Open yoursettings.phpfile (usually insites/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 crThis 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
.htaccessfile exists in your Drupal web root (typicallyweb/) and matches the default Drupal version (unless you have custom rules). - For Nginx (common in Lando’s Drupal recipes): Ensure your
.lando.ymlhas the correct webroot setting. Example:appserver: type: php:8.1 webroot: web config: server: nginx
- For Apache: Confirm the
Validate Login Route Exists
Check if the/user/loginroute is registered:lando drush routes:list | grep user/loginIf no results appear, enable the core
usermodule if it’s disabled:lando drush pm:enable user -yEnable 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
相关产品推荐
相关产品推荐

