Skip to content

Instantly share code, notes, and snippets.

@isyutaro
Created May 19, 2014 21:51
Show Gist options
  • Save isyutaro/d44afcbc70b4e350ff73 to your computer and use it in GitHub Desktop.
Save isyutaro/d44afcbc70b4e350ff73 to your computer and use it in GitHub Desktop.
Cambiar URL Wordpress
# Para cambiar URL en wordpress, con agregar dos variables en wp-config.php es suficiente
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
# y en base de datos hacemos lo siguiente:
UPDATE wp_options SET option_value = replace(option_value, 'http://old-domain.com', 'http://new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://old-domain.com', 'http://new-domain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://old-domain.com', 'http://new-domain.com');
# Por si queda algun dominio perdido, modficamos nginx para que haga el redirect.
server {
listen 80;
server_name old-domain.com;
return 302 http://new-domain.com$request_uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment