Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsIf a WordPress site worked in MAMP but shows a 500 error, sends posts to 404 pages, or redirects visitors to localhost:8888 after deployment, repair the live copy in this order: preserve the old .htaccess, regenerate rewrite rules from Settings > Permalinks, verify Apache’s rewrite support, correct the two WordPress URL fields, remove temporary relocation settings, and then read the server and WordPress logs.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
The symptoms overlap, so changing random rewrite lines is inefficient. A 500 error points to a server or PHP failure, a post-only 404 usually indicates rewrite handling, and a localhost redirect means the live site still has an old URL somewhere. The checks below separate those causes without destroying the file you need for comparison.
As an Amazon Associate I earn from qualifying purchases.
Why a MAMP migration can break .htaccess
MAMP commonly serves WordPress from a local Apache installation at an address such as http://localhost:8888. The live site has a different host name, document-root path, HTTPS setting, and Apache configuration. WordPress permalinks depend on rewrite rules in .htaccess; those rules are interpreted by the live server, not by MAMP.
A migration can therefore leave three different problems:
#1 Best Overall
- 500 Internal Server Error: Apache or PHP rejects a directive, or another server-side error is present. A malformed
.htaccessis commonly cited as one possible cause, but there is no reliable published percentage showing how often it causes migration failures. - Homepage works, posts or pages return 404: the front page can load without the rewrite rules needed for “pretty” permalinks. The live server must support Apache
mod_rewriteand allow directory-level overrides. - Redirects to localhost: the WordPress Address, Site Address, or stored content still contains the MAMP URL or port.
Fixing the rewrite file will not correct a database URL, and changing the URL will not make an Apache module load. Treat each symptom as a branch in one migration checklist.
Prepare a safe rollback
Keep the old file instead of deleting it
Connect to the live site with the host’s file manager, SFTP, or SSH and locate the .htaccess file in the WordPress document root. Rename it to something such as .htaccess_old. Renaming preserves the original rules while taking them out of Apache’s normal file name. If the site becomes less functional, you can compare the old contents or restore the name after correcting the underlying issue.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchEnable “show hidden files” in a file manager if the file is not visible. Do not create several active variants such as .htaccess-old and .htaccess-backup and assume Apache will read them; Apache reads the file named .htaccess.
Record the live address and a test set
Write down the exact live domain, including whether it uses HTTPS, and choose three URLs to test later: the homepage, one individual post, and one ordinary page. This makes it possible to tell a rewrite fix from a cache hit or a page that was never migrated.
Regenerate WordPress rewrite rules first
This is the least error-prone repair because WordPress generates the block that matches its current permalink setting.
- Sign in to the live site’s WordPress dashboard.
- Open Settings > Permalinks.
- Do not change the selected permalink structure. Click Save Changes.
- WordPress will write a fresh WordPress block to
.htaccessif the web server permits it. If WordPress reports that it cannot write the file, copy the rules it displays and place them in the live.htaccessmanually. - Confirm that a new file named exactly
.htaccessexists in the document root. Leave.htaccess_oldin place until testing is complete.
Saving the screen is intentional even when no setting changed: it forces WordPress to rebuild its rewrite rules for the live installation. A successful save does not prove that the host supports rewrites; it proves only that WordPress could write the file.
Recommended Free Tools
Rank #2
- Used Book in Good Condition
Manual editing when WordPress cannot write
If permissions or the host configuration prevent an automatic write, use the rule block supplied on the Permalinks screen rather than copying a block from an unrelated installation. A standard WordPress block has this shape:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The exact block displayed by WordPress is authoritative for that installation. Preserve any unrelated, host-required directives outside the WordPress markers, and check that every directive is spelled correctly. A hand-written rule can restore control, but it is easier to introduce a syntax error than when WordPress writes the block.
Verify the live server can use the rules
Apache and mod_rewrite
Pretty permalinks require Apache with mod_rewrite. If the host is running IIS, Apache’s mod_rewrite cannot be used. Ask the host which web server handles the domain and whether the rewrite module is enabled before repeatedly editing WordPress files.
Directory overrides
Even with Apache and the module present, the server can be configured to ignore .htaccess. The relevant Apache directory setting is commonly called AllowOverride. A local MAMP installation may permit overrides while the live virtual host does not. This is a host configuration to verify, not a guaranteed explanation for every migration.
Free tools Windows power users keep installed
One-click scans. No signup required.
Give the host the document-root path and ask them to confirm that:
- Apache is serving the live domain.
mod_rewriteis loaded.- The WordPress directory permits the rewrite directives in
.htaccess. - The server error log shows whether a directive is rejected.
If the host confirms that overrides are disabled, no WordPress dashboard action can compensate for that setting. The host must change the virtual-host or directory configuration, or provide its supported permalink method.
Correct WordPress’s two site URLs
In the live dashboard, open Settings > General and inspect both fields:
- WordPress Address (URL): where the WordPress core files are installed.
- Site Address (URL): the address visitors use for the site.
For a normal single-site deployment, both should use the live domain, begin with https:// when HTTPS is configured, and have no trailing slash. Neither field should contain localhost, localhost:8888, an MAMP directory, or another temporary host name.
If the fields are locked or the dashboard cannot load because it is redirecting to the old address, define the values in wp-config.php:
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
Replace https://example.com with the real live URL and omit the final slash. These constants override the values stored in the wp_options table; they do not update those database values. If the constants are later removed, WordPress will use the old stored values again, so treat this as a deliberate configuration choice or a way to regain access while you update the database.
Choose an override or a persistent database change
| Approach | What it changes | Best use | Trade-off |
|---|---|---|---|
Define WP_HOME and WP_SITEURL in wp-config.php |
Overrides the database values at runtime | Quickly fixes an inaccessible dashboard or a known URL mismatch | Hard-codes the address; removing the lines exposes the old stored values again |
Edit the wp_options values |
Persists the address in the database | A completed migration where database access is available | Requires careful database work |
Whichever route you use, make the WordPress Address and Site Address agree with the domain that actually serves the files. Do not add a slash merely to make a redirect look different.
Remove temporary relocation settings
Some migrations temporarily add the RELOCATE constant to wp-config.php. It is a relocation aid, not a permanent setting. Once the live URL is correct and the dashboard is accessible, remove the constant. Leaving it in place is insecure and can cause WordPress to keep recalculating the address during future requests.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #4
After editing wp-config.php, check that the file remains valid PHP and that the constants are defined only once. Keep a copy of the pre-edit file outside the web root so you can undo a typo without exposing backup files publicly.
Find the actual cause of a 500 error
The number “500” identifies a server-side failure, not a particular .htaccess line. If regenerating the file does not restore the site, turn on WordPress debug logging and inspect the web server’s error log. The message determines whether the next action belongs to Apache, PHP, WordPress, or a plugin.
Use logging rather than displaying errors to visitors
Enable WordPress’s debug logging in the configuration appropriate for your deployment, reproduce the failing request once, and then read the resulting log together with the server log. Look for the first error at the time of the request. A PHP fatal error, a permissions error, and an Apache “invalid command” message require different fixes; changing rewrite rules cannot resolve all three.
After collecting the evidence, turn off temporary debugging that is no longer needed. Do not use a generic 500 message as proof that the old MAMP path is the cause.
Use the old file as a controlled comparison
With the site backed up, compare .htaccess_old and the newly generated file. Identify directives that belong to the local environment, reference a MAMP path, or were added by a local-only tool. Do not paste every old line back into the live file. Add only a directive that the live host documents as supported, and test after each deliberate change.
Clean up MAMP URLs left in the database
Correcting the two URL fields changes WordPress’s main address, but old local strings can remain in other options, post content, menus, widgets, or plugin settings. MAMP remnants commonly include localhost:8888 and paths such as /Applications/MAMP. A browser may therefore reach the live homepage while individual links, images, or redirects still point to the local machine.
Best Value
- Used Book in Good Condition
Search and replace safely
Use a migration-aware search-and-replace tool, such as the WP-CLI wp search-replace command, to replace the exact old URL with the exact live URL. First run it in a dry-run or equivalent preview mode, review the affected tables and counts, and keep a database backup. The tool must understand serialized data; a plain text replacement can corrupt serialized option lengths and break plugins or widgets.
Replace the complete old URL, including its port and path, rather than searching for a short word such as “localhost.” Then test links, media URLs, menus, and widgets. Do not run a replacement against an unrelated database or repeat it with a partially changed URL unless the preview shows the intended matches.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Diagnose by the symptom you see
| Observed result | What it suggests | Next check |
|---|---|---|
| Every request returns 500 | Apache, PHP, a directive, or another server-side failure | Read the Apache and WordPress logs; temporarily move the active .htaccess aside to test whether Apache can serve the site without it |
| Homepage loads, posts and pages return 404 | Rewrite rules are missing, ignored, or unsupported | Resave Settings > Permalinks, then verify Apache, mod_rewrite, and directory overrides |
| Dashboard or links redirect to localhost | A URL field, constant, or stored database value still contains the MAMP address | Check both General Settings fields, WP_HOME/WP_SITEURL, and serialized database content |
| Changes appear ineffective | A plugin, server, or browser cache is serving an earlier response | Clear the relevant caches and retest the homepage, a post, and a page |
The table is a decision aid, not a substitute for the logs. A site can have more than one migration fault at the same time—for example, correct rewrite rules and an outdated image URL.
Test the repaired site and clear caches
- Open the homepage in a private browser window.
- Open one individual post using its normal permalink.
- Open one ordinary page, such as an About page.
- Check that the browser remains on the live HTTPS domain and never requests
localhost. - Review the page source or browser network panel for obvious local URLs in links and assets.
- Clear any WordPress caching plugin and the server cache after the rewrite or URL change.
- Repeat the three-URL test after the cache is cleared.
A successful homepage load alone is insufficient. The post and page requests exercise the rewrite rules that commonly fail after a MAMP move. If only one URL fails, record its exact path and correlate its timestamp with the logs before changing more configuration.
Regeneration versus hand-written rules
| Fix | Advantages | Risks or limits |
|---|---|---|
| Rename the old file and save Settings > Permalinks | Fast; WordPress generates a block for the current installation; no manual rule syntax | Fails to write when file permissions or server overrides prevent it; does not enable Apache modules |
| Hand-write or paste the WordPress block | Works when the dashboard cannot write the file; gives direct control over file contents | Syntax errors can trigger a 500; an unrelated local directive may be incompatible with the live host |
Use regeneration as the default. Use manual editing only when the screen supplies the rules or the host gives a documented requirement, and retain the renamed file until the live tests pass.
Migration completion checklist
- The former live file is preserved as
.htaccess_oldor another inactive backup. - A fresh
.htaccesswas generated by saving Settings > Permalinks, or the displayed block was pasted manually. - The live server is Apache with
mod_rewrite, and the host has confirmed that directory overrides are allowed. - WordPress Address (URL) and Site Address (URL) use the live HTTPS domain with no trailing slash.
- No
localhost:8888or MAMP path remains in configuration or serialized database content. - Any temporary
RELOCATEconstant has been removed. - Debug and server logs were checked for the real error instead of relying on the symptom alone.
- The homepage, one post, and one page work after caches are cleared.
If these checks pass, the migration problem was addressed at the correct layer: WordPress generated the rules, Apache accepted them, and the site now advertises and stores the live address. If a failure remains, preserve the exact URL and log message and give those details to the host or developer rather than repeatedly deleting .htaccess.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




