Search code examples
wordpressapachemod-rewrite

Redirection wordpress URL


I'm trying to keep an old URL with Apache and mod_rewitre, but the problem is that I only managed to do a redirect of this type:

Redirect permanent http:/newdomain.ie/old.html http:/olddomain.ie/

I need to keep the old URL because that way I don't lose the SEO, ADS and the google index, it is a blog that has more than 40 thousand entries with high daily visits. And changing URL would generate monetary loss.

I have all my old URLs and my new URLs, I only need this step to complete the migration. It is a migration from JOOMLA to WOrdpress.

Example of an old URL:

http://midominio.net/~domini/index.php?option=com_k2&view=item&id=67048:karina-deslumbro-en-la-concha-acustica-de-colina-de-bello-monte-fotos&Itemid=139

And my new URL is as follows:

https://midominio.net/karina-deslumbro-en-la-concha-acustica-de-colina-de-bello-monte-fotos

Apache offers many options, but I want to keep my old url, there is only one thing that repeats in new or old urls.

Some help?


Solution

  • After a while the solution for redirects with mod_Rewrite is:

    Where only regular expressions are applied for which is random in the urls.

    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/index.php$
    RewriteCond %{QUERY_STRING} ^option=com_k2&view=item&id=([0-9]+):(.+)&Itemid=([0-9]+)$
    RewriteRule ^(.*)$ http://www.tudominio.net/%2? [R=301,L]