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

Magento 1.9.X服务器迁移后无法登录及后台404错误求助

Hey there, let's work through this Magento admin 404 issue you're facing after migration. Based on the steps you outlined, here are targeted troubleshooting fixes to get things back on track:

Troubleshooting Magento Admin 404 Post-Migration

First, let's recap your workflow to align on context:

  • Packaged the Magento instance on the old server (excluding the download folder)
  • Exported and compressed the MySQL database
  • Unpacked the instance on the new server, imported the old database
  • Updated web_secure and web_unsecure values in core_config_data

Now let's dive into fixing that admin 404 error:

1. Double-Check Admin URL Settings in core_config_data

You updated the frontend URLs, but it's easy to overlook the admin path configuration. Run this SQL query in your new database to verify:

SELECT * FROM core_config_data WHERE path LIKE 'admin/url/%';
  • If you use a custom admin path: Ensure admin/url/custom matches your new server's admin URL, and admin/url/use_custom is set to 1.
  • If you use the default admin path: Make sure admin/url/use_custom is 0 and admin/url/custom is empty.

2. Flush All Magento Cache (Don't Skip This!)

Migration almost always leaves stale cache files hanging around, which can break URL routing. You can flush cache two ways:

  • Command Line (recommended): SSH into your new server and run:
    # For Magento 2
    php bin/magento cache:flush
    php bin/magento cache:clean
    
    # For Magento 1
    php shell/cache.php --flush
    
  • Manual Flush: Delete all folders inside var/cache/, var/page_cache/ (Magento 2 only), and var/generation/ (Magento 2 only).

3. Fix File Permissions

Incorrect permissions are one of the most common causes of 404s post-migration. Set the correct permissions based on your Magento version:

# Magento 2 Permissions
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod u+x bin/magento
chown -R www-data:www-data /path/to/your/magento/instance # Adjust user/group to match your server

# Magento 1 Permissions
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 777 var/ var/media/ var/session/ var/tmp/
chown -R www-data:www-data /path/to/your/magento/instance

4. Verify Rewrite Rules and .htaccess

  • Ensure the hidden .htaccess file was copied over from the old server—hidden files are easy to miss during packaging. If it's missing, grab a fresh copy matching your Magento version.
  • For Apache users: Confirm mod_rewrite is enabled with these commands:
    a2enmod rewrite
    systemctl restart apache2
    
  • For Nginx users: Double-check that your server block includes the official Magento rewrite rules to handle URL routing correctly.

5. Rule Out the download Folder Exclusion

While excluding the download folder shouldn't impact the admin directly, it's worth copying it over from the old server just to eliminate any edge cases. Some older Magento versions use this folder for specific asset storage, and missing files here could cause unexpected 404s for admin resources.

6. Confirm Server Document Root

  • For Magento 2: Your server's document root must point to the pub folder—not the main Magento root. If it's set incorrectly, this will break both frontend and admin URLs.
  • For Magento 1: The document root should point directly to the main Magento folder.

If you can share more details about what happens when you enter the other URL (e.g., frontend loading issues, different error messages), we can narrow this down even further!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 09:50:52