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:
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://localhostor your custom local domain—no leftover MacBook-specific URLs here!). - Confirm
_PS_REWRITING_SETTINGS_matches your original setup:1if you had friendly URLs enabled,0if not. This needs to align with both your database and.htaccessrules.
PrestaShop's friendly URLs rely entirely on mod_rewrite, so this is a common failure point:
- Enable mod_rewrite: Run
apachectl -Min your terminal. If you don't seerewrite_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 withbrew services restart httpd. - Validate .htaccess: Make sure you copied the hidden
.htaccessfile 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 hasAllowOverride Allset (otherwise.htaccessrules won't apply):
Restart Apache after making this change.<Directory "/path/to/your/prestashop/root"> AllowOverride All Require all granted </Directory>
Migration cache conflicts are brutal—clear everything related to PrestaShop and your server:
- Delete all files/folders in
var/cache/(leave.htaccessandindex.phpif they exist) - Empty
var/smarty/cache/andvar/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
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 & SEOand 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
mysqlCLI), find theps_configurationtable, and update thePS_SHOP_DOMAINandPS_SHOP_DOMAIN_SSLvalues to your Mac Pro's domain/IP.
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.phpfile in your PrestaShop root with this content:
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<?php phpinfo(); ?>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.
If all else fails, disable friendly URLs temporarily to isolate the issue:
- In
config/settings.inc.php, set_PS_REWRITING_SETTINGS_to0 - 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

