I'm trying to setup virtual directories with .htaccess.
I want to use this directories as language indicators. E.g. example.com/de-de
, example-com/de-en
and so on. But in fact, the directories doesn't exist on the server and the index.html
file at the root of the directory should be loaded. I wrote some rules, but they dont work properly:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
URLs like example.com/de-de
works, but example.com/de-de/
doesn't. When I open example.com/de-de/
it tries to load resources from the /de-de/
subdirectory, e.g. de-de/js/jquery.js
instead of /js/jquery.js
. Whats wrong with my rules? And is there a way to force a trailing slash, so users will be redirected from example.com/de-de
to example.com/de-de/
?