A
A
Andrey Khokhlov2014-08-13 06:29:58
Joomla
Andrey Khokhlov, 2014-08-13 06:29:58

How to move a site to a new domain with a new url structure?

There is an old site (something like a blog), on Joomla 1.5 with a large number of articles (700+) and good positions in Yandex.
The task is to transfer the site to wordpress (the articles have already been transferred), with a new domain and a different URL structure.
The URLs are quite different.
The old site now has:
old-site.ru/index.php/%category%/%sub-category%/%id%-nazvanie-posta.html
The new one will have something like:
new-site.ru/%category %/%year%/%month%/%day%/nazvanie-posta.html
The articles I find talk about 301 redirects (including Yandex itself - https://help.yandex.ru/webmaster/yandex-indexing /m... )
But a similar construction in .htaccess

<FilesMatch "robots.txt$">
RewriteEngine off
</FilesMatch>
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://new.name/$1 [R=301,L]

it will just send it to a new domain with the old url (that is, to a 404 page)
The second tip from Yandex, add to each page:
<meta http-equiv="refresh" content="0;URL='http://new-site.com/'">

And this is 700+ pages ...
How to be?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Damir Rysaev, 2014-08-13
@freepad

If the title of the posts is unique.
1. When redirecting, we send the title of the post, via GET, POST or headers.
2. Looking for a page $query = new WP_Query( 's=keyword' );
3. If at least one post is found, we redirect to this post (we're lucky), if we don't find it, we redirect to the 404 page.
To separate posts from categories, you can send additional parameters.
Search for categories via get_cat_ID( $cat_name );

S
sasha, 2014-08-13
@madmages

1. if you have all the old urls in the database and just compare them with the articles, then it’s easy to make redirects: add a new url to each url and redirect there.
2. if your old links were not in the database but were processed in some other way, then I'm very sorry... but in this situation you need to know about the article the data that will be used in the new url-building (date day number hour, etc.) and make redirects from old urls to new
ones

S
Sergey Romanov, 2014-08-14
@Serhioromano

As one of the options, make a small plugin that will catch old urls and redirect to new ones.
When you get the old url, you can make a non-CNC url and pass it through the router and you will get your url.
for example

$url = JUri::getInstance()->toString();
if($url ...) {
    $new = 'index.php?option=com_content&Itemid=10&view=article&id='.$id;
    JFactory::getApplication()->redirect(JRoute::_($new, FALSE));
}

V
Viktor Taran, 2016-04-12
@shambler81

everything is simply obscene.
https://donatstudios.com/RewriteRule_Generator
and go

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question