地理定位网站仍然使seo正常工作

so i im developping a geolocation system for a project and i have a doubt regarding seo best practices.

i have the same website in 4 languages: pt(portugal), br(brazil), org(international) and dk(Denmark) and for example if a brazilian citizen enters on portuguese website i redirect him to the brazilian one, but i dont know how that will affect the seo of the website, i cant do 301 redirect because by doing that im telling google that the portuguese website no longer exists for him, so how should i redirect to the other website without take it form google indexation?

If I understand your question correctly, you basically want to do a soft redirect for user depending on their IP address location.

You could always have a PHP redirect at the top of the page once you have detected the IP location;

header("HTTP/1.0 307 Temporary Redirect");
header("Location: http://www.example.com/");

This will stop the redirect from being seen as permanent.

You may also want to make sure that you never redirect search engines, you can do this by examining the user agent in the headers.

$_SERVER['HTTP_USER_AGENT']

Another option would be to have a simple pop-up saying that you have detected a different location/language from the websites and thus giving them the option to redirect to the website with the correct TLD.

Also make sure you set the lanauage META tags for each website.

<meta name="language" content="spanish">