How do you add subdirectories localization to your website?
#1

Hi guys, I'm still learning stuff and need some help. How do you add subdirectories localization to your website? Some websites uses subdirectories for languages for example www.website.com/en/ or www.website.com/fr/. I'm currently using URL parameters for my website which would be www.website.com?lang=en and based on that I fetch data from my database. But I guess just www.website.com/en/ looks way better. So how do it do it? My website is not static so I cannot just create actual subdirectories plus I have over 40 languages/translated data in my database. Any help would be appreciated.
Reply
#2

idk if i understand your question correctly but i think you may be looking for clean/friendly urls. For me you just need to edit the apache config and set the AllowOverride All on the directory
Reply
#3

use rewrite feature, here is the tutorial for nginx and apache
Reply
#4

you could also use subdomains
Reply
#5

Make new sub folders using FTP, those folders should be named like 'ru' or 'en' etc, they will contain the versions of site in different languages. (Never tried) Check if it works.
Reply
#6

Quote:
Originally Posted by K0P
View Post
Make new sub folders using FTP, those folders should be named like 'ru' or 'en' etc, they will contain the versions of site in different languages. (Never tried) Check if it works.
Just no.. Just rewrite the url via nginx or apache(htaccess).
Reply
#7

Use this tool to do exactly what you want https://www.generateit.net/mod-rewrite/index.php .

Enter in the url you have with the standard query string arguments. It will then give you a form to rewrite that so it looks like a subdirectory. It will give you the code then to add to your .htaccess file.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)