0

I have a Multilingual website with directory structure

/home
/home/en
/home/es
...
/home/xx
...

My domain www.foo.com points at /home. But actually /home has nothing under it except for the language subdirectories, which is where the HTML etc live.

I would like both www.foo.com and www.foo.com/en to point at /home/en. For all other languages I would like www.foo.com/xx to point at /home/xx.

I have set up a redirect to point www.foo.com at /home/en, but that doesn't work because then www.foo.com/en to points at /home/en/en.

This may all be impossible, but can I somehow default www.foo.com to go to /home/en when the language is missing, and also make www.foo.com/xx always go to /home/xx.

Mark Kortink
  • 1,770
  • 4
  • 21
  • 36

1 Answers1

0

Found the answer here, its the second answer. You have to create a .htaccess file in your root directory with the line RedirectMatch ^/$ /en/. This redirects www.foo.com and only this domain to /home/en, it does not redirect www.foo.com/en at all.

I also wanted to redirect http to https. This is the http code that does it.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RedirectMatch ^/$ /en/
Mark Kortink
  • 1,770
  • 4
  • 21
  • 36