Redireccionar dominio completo manteniendo url de las páginas

Hay veces que te interesa cambiar el dominio de una página web, por diferentes motivos, y te interesa además que el mismo contenido en el nuevo dominio, necesitas hacer una redirección con reglas dinámicas.

Si es así, hay que utilizar el siguiente código, guardándolo en la raíz de tu página web antigua con el nombre .htaccess.

<IfModule mod_rewrite.c>
RewriteEngine On
redirectMatch 301 ^(.*)$ https://www.domain.com$1
</IfModule>

Por supuesto tendrás que cambiar https://www.domain.com por tu web nueva, teniendo especial atención si la has puesto https y con o sin www.

Finalmente, realiza la comprobación tu mismo y también utiliza la herramienta http://www.redirect-checker.org/ para terminar de comprobar todo.

Este código es sólo compatible para servidores Linux, que son la mayoría de ellos.

Mentions

Leave a Comment

LAtest articles

Cierre Ventana

How to prepare your plugin for the WordPress.org directory

At the WordCamp Europe in Krakow, Fran Torres and I were speakers. Just after lunch, with the audience…

Cierre Ventana

Preview plugins in WordPress Playground directly from the Pull Request

When someone opens a PR in a WordPress plugin, the usual process for reviewing it involves downloading the…

Cierre Ventana

3 years in the WordPress.org Team Plugins

Yesterday, May 5, 2026, I celebrate 3 years as part of the WordPress.org Plugins Team. And this last…