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);
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.