Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fix when MAMP localhost url is redirecting to another URL
/** Stops MAMP redirect to another URL and opens the site via localhost when using MAMP. Placed just below DB_COLLATE within the wp.config Wordpress file. **/
define('WP_HOME', 'http' . '://' . $_SERVER['SERVER_NAME'] .
preg_replace('#(^(\\\\|/|\\.)$|/(wp-admin|wp-content).*)#', '', dirname($_SERVER['SCRIPT_NAME']))
);
define('WP_SITEURL', WP_HOME);
@PStevensWave

This comment has been minimized.

Copy link

commented Jun 4, 2019

Add this to the wp-config.php file when setting up a local development environment. It can be dropped anywhere but usually is placed after the Database stuff in MySQL

@PStevensWave

This comment has been minimized.

Copy link

commented Jun 4, 2019

$_SERVER['HTTPS']='off';

This was also on there that needed to be turned from "on" to "off"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.