I am trying to make a multilingual page, and for now I can do this
domain.com/LANGUAGE/page-name
and it works.
The problem is that if I want to be in the index file with a language like
domain.com/LANGUAGE
I get a 404 error.
How can I do this?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(en|el)/(.*)?$ $2.php?lang=$1 [NC,L]
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Should not your last line be
RewriteRule ^([^\.]+)$ index.php?lang=$1 [NC,L]
This way any requests having only the language path will go to index.php
or just make a new rule where the path after the language does not exist
RewriteRule ^(en|el)(/)?$ index.php?lang=$1 [NC,L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.