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

PrestaShop 1.7.3.1在Mac Pro上所有前台页面均显示自带404错误求助

Hey there, let's work through this PrestaShop 404 issue you're hitting after moving your 1.7.3.1 store from MacBook Pro to Mac Pro. I've debugged plenty of migration-related quirks like this, so here's a step-by-step breakdown of what to check:

1. Double-Check Core Configuration Files

First, head to your PrestaShop root and open config/settings.inc.php:

  • Verify _PS_BASE_URL_ and _PS_BASE_URL_SSL_ are updated to your Mac Pro's local address (e.g., http://localhost or your custom local domain—no leftover MacBook-specific URLs here!).
  • Confirm _PS_REWRITING_SETTINGS_ matches your original setup: 1 if you had friendly URLs enabled, 0 if not. This needs to align with both your database and .htaccess rules.
2. Fix Apache mod_rewrite & .htaccess Issues

PrestaShop's friendly URLs rely entirely on mod_rewrite, so this is a common failure point:

  • Enable mod_rewrite: Run apachectl -M in your terminal. If you don't see rewrite_module (shared), edit your Apache config (Homebrew installs usually use /usr/local/etc/httpd/httpd.conf), uncomment the line #LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so, then restart Apache with brew services restart httpd.
  • Validate .htaccess: Make sure you copied the hidden .htaccess file from your MacBook (hidden files can get skipped during transfers!). Check that it has the default PrestaShop rewrite rules—here's the key section to confirm:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    RewriteRule ^api$ api/ [L]
    RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
    </IfModule>
    
  • Allow .htaccess overrides: In your Apache virtual host config, ensure the <Directory> block for your PrestaShop folder has AllowOverride All set (otherwise .htaccess rules won't apply):
    <Directory "/path/to/your/prestashop/root">
        AllowOverride All
        Require all granted
    </Directory>
    
    Restart Apache after making this change.
3. Wipe All Caches (Trust Me, This Fixes 80% of Issues)

Migration cache conflicts are brutal—clear everything related to PrestaShop and your server:

  • Delete all files/folders in var/cache/ (leave .htaccess and index.php if they exist)
  • Empty var/smarty/cache/ and var/smarty/compile/
  • Restart your PHP service (e.g., brew services restart php@7.1) to clear OPcache if it's enabled
  • Test in incognito mode to bypass browser cache
4. Sync Database URL Settings

If your database was copied over but the store URLs weren't updated, this will break routing:

  • If you can access the backend: Go to Preferences > Shop Parameters > Traffic & SEO and update the "Shop URL" and "SSL Shop URL" fields to match your Mac Pro's address. Also confirm "Friendly URLs" is toggled correctly.
  • If backend is also broken: Open your database (use phpMyAdmin or mysql CLI), find the ps_configuration table, and update the PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL values to your Mac Pro's domain/IP.
5. Confirm PHP Environment Compatibility

You mentioned multiple PHP versions—make sure Apache is using the right one for PrestaShop 1.7.3.1 (it officially supports 7.1-7.2):

  • Create a temporary info.php file in your PrestaShop root with this content:
    <?php phpinfo(); ?>
    
    Access it in your browser to check the active PHP version. If it's not 7.1, update your Apache config to use the correct PHP module (Homebrew's php@7.1 uses lib/httpd/modules/libphp7.1.so).
  • Check PHP error logs (e.g., /usr/local/var/log/php/7.1.log) for any hidden errors that might be breaking the routing logic—sometimes a missing PHP extension can trigger a silent failure that manifests as a 404.
6. Test Without Friendly URLs

If all else fails, disable friendly URLs temporarily to isolate the issue:

  • In config/settings.inc.php, set _PS_REWRITING_SETTINGS_ to 0
  • Access your store using http://your-domain/index.php (e.g., http://localhost/index.php). If this works, the problem is definitely with your URL rewriting setup—go back to step 2 to fix mod_rewrite or .htaccess.

Start with the cache and config file checks first—those are the quickest wins for migration-related 404s. Let me know if any of these steps resolve your issue!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 08:16:51