【发布时间】:2015-03-17 07:13:14
【问题描述】:
我有这个使用 php 的多语言系统的网址:
http://mydomain/ <-- default language english (en)
http://mydomain/index.php?lang=de
http://mydomain/index.php?lang=fr
http://mydomain/index.php?lang=tr
现在,对于另一个页面,我有这个网址:
http://mydomain/article.php?id=xx <-- show article details
http://mydomain/article.php?list=all <-- show article archive
http://mydomain/gallery.php?id=xx
http://mydomain/faq.php?id=xx
http://mydomain/faq.php?list=all
http://mydomain/contact.php
现在,我需要像这样使用 php 和 htaccess 创建 seo 友好的 url:
对于索引:
http://mydomain/ <-- for default
http://mydomain/de/
http://mydomain/fr/
对于文章ie:(domain/lang/id/title.html)
http://mydomain/de/articles/22/test.html
对于页面:
http://mydomain/de/contact.html
存档:
http://mydomain/de/articles/listall.html
在 htaccess 中,我为文章编写了这段代码:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^articles/([0-9]+)/([A-Za-z0-9-]+)/?.html$ articles.php?id=$1
但这适用于一种语言而不是多种语言。如何为多语言系统创建 seo 友好的 url?!
【问题讨论】: