Mobile app version of vmapp.org
Login or Join
Heady270

: Generate seo friendly url for multi language system I have this url's for multi language system using php : http://mydomain/ <-- default language english (en) http://mydomain/index.php?lang=de http://mydomain/index.php?lang=fr

@Heady270

Posted in: #Htaccess #Seo #UrlSlug

I have this url's for multi language system using php :
mydomain/ <-- default language english (en) mydomain/index.php?lang=de http://mydomain/index.php?lang=fr mydomain/index.php?lang=tr

Now, for another page i have this url:
mydomain/article.php?id=xx <-- show article details mydomain/article.php?list=all <-- show article archive mydomain/gallery.php?id=xx http://mydomain/faq.php?id=xx mydomain/faq.php?list=all http://mydomain/contact.php


Now, i need to create seo friendly url using php and htaccess Like This :

for index:
mydomain/ <-- for default mydomain/de/ http://mydomain/fr/


for article ie:(domain/lang/id/title.html)
mydomain/de/articles/22/test.html

for page:
mydomain/de/contact.html

for archive:
mydomain/de/articles/listall.html

in htaccess i write this code for article :

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^articles/([0-9]+)/([A-Za-z0-9-]+)/?.html$ articles.php?id=


but this worked for one language not multiple language. how do can i create seo friendly url for multi language system?!

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Heady270

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

Try something like
RewriteRule ^([en|es|ru|de]{2})/(.*)$ ?lang=&%{QUERY_STRING} [L,QSA]

Where you'll want to replace [en|es|ru|de] with the all valid 2-letter language codes your site uses. This will then take whatever is after the language-code in the URL, and use that as the "main" URL, and then effectively append ?lang=es to the "actual" URL, though the user will not see this, it will happen in the background.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme