For a client we have setup a multilanguage website that consists of an English and Dutch part. The urls look like:
www.example.com
for the english website and www.example.com/nl/
for the dutch website
However, I want to change this www.example.com
to www.example.nl
instead of www.example.com/nl/
How to get this? We already have setup that both domains (example.com and example.nl) point to the same root. But we not yet able to have the /nl/ extension point to example.nl
Hope someone can help me.
Just define two virtual hosts with different DocumentRoot. Apache Core Features / DocumentRoot Directive
You will need to set the /nl/ directory as root for your .nl Domain.
I've not tried this, but I believe the Move Homedirs to Different Webserver example is a good fit for this problem. First, the example:
On the old webserver we just redirect all /~user/anypath
URLs to
http://newserver/~user/anypath
.
RewriteEngine on
RewriteRule ^/~(.+) http://newserver/~$1 [R,L]
And my thought on how this would work for you:
RewriteEngine on
RewriteRule ^/nl/(.+) http://newserver.nl/1 [R,L]
FallbackResource
looks useful, but it cannot re-write http://example.com/nl/Hallo/Neue/Welt
to http://example.nl/Hallo/Neue/Welt
. The result is useless URLs in bookmarks, previous documentation, and search engines - sarnold 2012-04-04 08:39
.nl
is brand-new, and presumably they won't want to invalidate all the old content from .com/nl/
. My approach will put the new URLs in the address bar for future correct use, allow old URLs to function with no annoyance to end users, and -- despite my misgivings about how the re-write module is abused -- this is simple to read and simple to maintain - sarnold 2012-04-04 08:53