如何将多语言站点重定向到默认语言页面?

时间:2021-09-25 07:56:52

I have this:

我有这个:

http://example.com/EN/index.php - english version

http://example.com/EN/index.php - 英文版

http://example.com/PT/index.php - portuguese version

http://example.com/PT/index.php - 葡萄牙语版本

What I want: http://example.com/ to be taken to the portuguse page by default.

我想要的是:http://example.com/默认情况下被带到portuguse页面。


I've also been thinking on having the portuguese page on the root and english in the EN/ directory. is this better for SEO?

我一直在考虑在EN /目录中的根和英语上有葡萄牙语页面。这对SEO更好吗?

1 个解决方案

#1


iam not sure if i understand the problem, but you can create an index.php in your root and change the header to forward the user to the PT/index.php

我不确定我是否理解了这个问题,但您可以在根目录中创建一个index.php并更改标题以将用户转发到PT / index.php

Header("Location: ./PT/index.php");

later you can construct an if/else check to verify the language of the browser etc..

以后你可以构造一个if / else检查来验证浏览器的语言等。

#1


iam not sure if i understand the problem, but you can create an index.php in your root and change the header to forward the user to the PT/index.php

我不确定我是否理解了这个问题,但您可以在根目录中创建一个index.php并更改标题以将用户转发到PT / index.php

Header("Location: ./PT/index.php");

later you can construct an if/else check to verify the language of the browser etc..

以后你可以构造一个if / else检查来验证浏览器的语言等。