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

将WordPress站点的WooCommerce迁移至子域名求助

Hey there! Moving your WooCommerce store (including shop, cart, account pages, etc.) to a subdomain is totally achievable— I’ve walked through this process with several users before, so let’s break down the key steps and critical things to keep in mind:

1. Pre-Migration Prep (Don’t Skip This!)
  • First off, back up your entire main site— database, core files, themes, plugins, and all WooCommerce data. Use a backup plugin or your host’s backup tool; you’ll want a safety net if anything goes sideways.
  • Confirm your hosting provider supports subdomains (most do). Head to your host’s control panel to create the subdomain (e.g., shop.yourdomain.com) and assign it to a dedicated directory on your server.
2. Set Up the Subdomain WordPress Installation
  • Install a fresh WordPress instance on your new subdomain. You can use your host’s one-click installer or manually upload the WP core files.
  • Activate the WooCommerce plugin on the subdomain site, but hold off on configuring settings (like payment gateways or shipping) until after data migration.
3. Migrate WooCommerce Data
  • Export from your main site: Go to WooCommerce > Tools > Export in your main WordPress dashboard. Select all the data types you need (products, orders, customers, coupons, etc.) and download the CSV files.
  • Import to the subdomain: On the subdomain’s WooCommerce dashboard, go to WooCommerce > Tools > Import. Upload the CSV files you exported, double-check that fields match correctly, and run the import. Afterward, verify that all data transferred properly (product images, inventory levels, order statuses, etc.).
  • For more precise control (if you’re comfortable with databases): Use phpMyAdmin to export tables related to WooCommerce from your main site’s database (e.g., wp_posts, wp_postmeta, wp_woocommerce_products, wp_woocommerce_orders). Import these tables into the subdomain’s database, then update the siteurl and home values in the wp_options table to your subdomain’s URL.
  • Bulk replace old URLs: Use a search-replace tool to update all internal links from your main domain to the subdomain. If you use WP CLI, run this command (replace the domain examples with yours):
    wp search-replace 'https://yourdomain.com' 'https://shop.yourdomain.com' --skip-columns=guid
    
    Alternatively, use a reputable WordPress plugin designed for search-replace.
  • Configure WooCommerce settings: On the subdomain site, go to WooCommerce > Settings and update all URL-related fields (shop base address, cart page, account page, checkout page) to point to the subdomain.
  • Set up 301 redirects: Add rules to your main site’s .htaccess file to redirect old WooCommerce pages to the subdomain. This preserves SEO and user experience. Example rules:
    RedirectMatch 301 ^/product/(.*)$ https://shop.yourdomain.com/product/$1
    RedirectMatch 301 ^/cart/$ https://shop.yourdomain.com/cart/
    RedirectMatch 301 ^/my-account/(.*)$ https://shop.yourdomain.com/my-account/$1
    RedirectMatch 301 ^/checkout/(.*)$ https://shop.yourdomain.com/checkout/$1
    
5. Test Every Critical Function
  • Walk through the full customer journey: Browse products, add items to cart, proceed to checkout, test payment gateways (use sandbox mode!), log into customer accounts, and view order history.
  • Check for broken images, dead links, or styling issues— especially if you’re using a custom theme. Make sure your theme and WooCommerce-compatible plugins work seamlessly on the subdomain.
  • Test on mobile devices to ensure responsive design holds up, and clear all cache (on both main site and subdomain) to avoid serving outdated content.
6. Post-Migration Maintenance
  • Set up regular backups for the subdomain site separately from your main site.
  • Keep WordPress, WooCommerce, plugins, and themes on the subdomain updated to the latest versions (same as your main site, if applicable).
  • Submit the subdomain’s sitemap to Google Search Console and monitor traffic/metrics to ensure no significant drops in visibility or conversions.

A few extra tips:

  • If your main site and subdomain are on the same server, double-check file permissions to avoid access errors.
  • If you use a CDN, update its settings to include the subdomain and purge cached content after migration.

内容的提问来源于stack exchange,提问作者brad walls

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 04:25:02