多语言PHP网站URL文件名更改
我目前有一个多语言 PHP 网站,一切正常。然而,“切换语言”时“文件名”不会改变。
网址如下:
www.site.com/br/article.pt.php
www.site.com/en/article.en.php
我希望它们是:
www.site.com/br/meuartigo.pt.php
www.site.com/en/article.en.php
我该如何做到这一点?我可以执行从
www.site.com/br/article.pt.php
到
www.site.com/br/meuartigo.pt 的 301 重定向。 php
但我不认为这是最好的方法。
I currently have a multilanguage PHP site on which everything works fine. However, the "file name" does not change when "switching the language."
The URLs are like this:
www.site.com/br/article.pt.php
www.site.com/en/article.en.php
I want them to be:
www.site.com/br/meuartigo.pt.php
www.site.com/en/article.en.php
How can I do this? I could just do 301 redirects from
www.site.com/br/article.pt.php
to
www.site.com/br/meuartigo.pt.php
but I don't think that's the best way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的目标应该是
“SEO 友好网址”的常见格式。
您可以在这个问题的答案中找到一种方法:
使用 PHP 模拟文件结构
Your goal should be
That's the common format for 'SEO friendly urls'.
You can get a way to do it in the answer to this question:
Simulate file structure with PHP