如何将无法访问后台的Magento 1.9.2站点迁移至新安装同版本目录?
Absolutely feasible! Since you’ve got a fresh, fully functional Magento 1.9.2 instance up and running, migrating your old site’s data, themes, and extensions to this new environment is a perfect fix for your admin panel access woes. Let’s walk through this step by step to make sure it goes smoothly:
Short answer: Yes, absolutely. Using the same Magento version eliminates most compatibility risks, and since your new instance is already verified to work, this approach will let you bypass the admin panel issue from your old setup entirely.
1. Migrate Database Data
This is the core of your site’s content—products, orders, customers, settings, etc. Follow these steps carefully:
- First, back up your old site’s database:
- Use phpMyAdmin to export the full database, or run this command in your terminal:
mysqldump -u [DB_USERNAME] -p [OLD_DB_NAME] > old_magento_backup.sql
- Use phpMyAdmin to export the full database, or run this command in your terminal:
- Next, clear out the default data from your new Magento’s database (keep the database itself and user permissions intact).
- Import your old database backup into the new database:
mysql -u [DB_USERNAME] -p [NEW_DB_NAME] < old_magento_backup.sql - Critical Update: Fix the base URLs in the new database to match your new environment:
- Open phpMyAdmin, navigate to the
core_config_datatable. - Find the rows where
pathequalsweb/unsecure/base_urlandweb/secure/base_url. - Update their
valuefields to your new site’s full URL (e.g.,https://your-new-domain.com/—don’t forget the trailing slash!).
- Open phpMyAdmin, navigate to the
- Clean up old cache and log data to avoid conflicts:
- Truncate the
core_cache,core_cache_tag, and alllog_*tables (likelog_customer,log_visitor).
- Truncate the
2. Migrate Themes
Your custom or third-party theme files live in two main directories—copy both:
- From your old site, copy the theme folder from
app/design/frontend/[PACKAGE]/[THEME]to the same path in your new site. - Copy the corresponding static assets (CSS, JS, images) from
skin/frontend/[PACKAGE]/[THEME]to your new site’sskin/frontend/directory. - After copying, log into your new admin panel, go to System > Configuration > Design, set your migrated theme as the default, and save the configuration.
3. Migrate Extensions
Extensions add critical functionality, so make sure you copy all relevant files and verify their setup:
Third-Party Extensions
- Copy the extension’s core code:
- From
app/code/local/[VENDOR]/[EXTENSION_NAME]orapp/code/community/[VENDOR]/[EXTENSION_NAME]to the same path in your new site. - Copy the extension’s activation file from
app/etc/modules/[VENDOR]_[EXTENSION_NAME].xmlto your new site’sapp/etc/modules/directory. - If the extension has frontend/adminhtml templates, layouts, or static assets, copy those from
app/design/andskin/directories as well.
- From
- Log into the new admin panel, navigate to the extension’s configuration page (usually under System > Configuration) to confirm settings are intact (most should be pulled from the migrated database, but double-check).
Custom Extensions/Custom Code
- Copy all your custom modules from
app/code/local/to the new site’sapp/code/local/directory. - Copy any custom templates, layouts, or static assets associated with these modules.
- Verify the modules are enabled: Check the
activeattribute in theirapp/etc/modules/XML files is set totrue.
4. Final Post-Migration Checks
Don’t skip these—they’ll ensure your site runs smoothly:
- Clear the new site’s cache and session files manually:
rm -rf var/cache/* var/session/* - Reindex all data: In the admin panel, go to System > Index Management, select all indexes, choose
Reindex Data, and submit. - Test the frontend: Load pages, check products, categories, and content to ensure everything displays correctly.
- Test the admin panel: Verify you can access all sections (orders, customers, product management) and that extensions work as expected.
- Test critical workflows: Place a test order, check customer registration, and confirm any payment/shipping modules function properly.
内容的提问来源于stack exchange,提问作者Haris Khan

