How to save url's after changing default language?

General questions regarding the use of languages in Joomla! 3.x.

Moderators: infograf768, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
posmishka
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Nov 12, 2019 7:11 pm

How to save url's after changing default language?

Post by posmishka » Tue Nov 12, 2019 8:11 pm

Hi,
having some problems and still my mind went blank.

There is the working website in such urls schema
website.net/ (homepage_on_RU)
website.net/article_on_RU
website.net/ua/article_on_UA

The goal was to switch main lang to UA
website.net/ (homepage_on_UA)
website.net/article_on_UA
website.net/ru/article_on_RU
this can be easy made with standard functions in lang filter. All routings will working properly.

BUT we will lost all indexed url's on RU (website.net/article_on_RU) & will having 404 on that url's.

It possible to define new url structure as
website.net/ (homepage_on_UA)
website.net/ua/article_on_UA
website.net/ru/article_on_RU

BUT old url's on RU (website.net/article_on_RU) will still having 404

Is it possible to do 301 redirect from all old urls (website.net/article_on_RU) to new ones with prefix /ru ? (by standard joomla functions)

Or does exist the other way to do that?
May be redirect only homepage to new language?
Or making some cookies hooks to catch this state?

Does anybody have solution for same situation?

Thanks.

smpleader
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 100
Joined: Thu Jun 21, 2012 7:17 am

Re: How to save url's after changing default language?

Post by smpleader » Wed Nov 13, 2019 12:54 am

Hi bro,
There are something which aren't clear: "All routings will working properly." then "lost all indexed url's"
What is "indexed url" here ?
And more, did you use Joomla association ( https://docs.joomla.org/J3.x:Multilingual_Associations ) ?

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18886
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: How to save url's after changing default language?

Post by infograf768 » Wed Nov 13, 2019 7:45 am

You will anyway lose all indexed item in Google.
You may have, but it depends on the size of the site:
OR use the redirect component
OR use a specific .htaccess
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

posmishka
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Nov 12, 2019 7:11 pm

Re: How to save url's after changing default language?

Post by posmishka » Thu Nov 14, 2019 8:41 am

smpleader wrote:
Wed Nov 13, 2019 12:54 am
Hi bro,
There are something which aren't clear: "All routings will working properly." then "lost all indexed url's"
What is "indexed url" here ?
And more, did you use Joomla association ( https://docs.joomla.org/J3.x:Multilingual_Associations ) ?
Hi, thanks for concernment

After changing the default language routings works well according to the parameters in lang filter plugin:

website.net/ (homepage_on_UA) > 200
website.net/article_on_UA > 200
website.net/ru/ (homepage_on_RU) > 200
website.net/ru/article_on_RU > 200

but old "indexed urls" website.net/article_on_RU > 404

& I will have 40k such urls (need to be reindexed by search bots again)

The most of them has active external links from FB, TW ...

The website is on K2 & I use Joomla association only for menus. Also non every article has translation.

posmishka
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Nov 12, 2019 7:11 pm

Re: How to save url's after changing default language?

Post by posmishka » Fri Nov 15, 2019 10:44 am

Thanks all.
We've accepted solution dont change the default lang to save urls.
To redirect only homepage to the "new default lang" I provided the code based on cookies setting.

Code: Select all

if ( !isset($_COOKIE['visited']) && ($_SERVER['REQUEST_URI'] == '/') ) { // no cookie, so probably the first time here & root domain
	setcookie ('visited', 'yes', time() + 3600); // set visited cookie

	header("Location: https://finclub.net/ua/");
	exit(); // always use exit after redirect to prevent further loading of the page
}


Post Reply

Return to “Language - Joomla! 3.x”