How to have 2 domains on the same website?

Go To StackoverFlow.com

0

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.comto 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.

2012-04-04 07:53
by Geert


2

Just define two virtual hosts with different DocumentRoot. Apache Core Features / DocumentRoot Directive

2012-04-04 08:08
by Roman Newaza
Could you provide me with an example? And will the website still work then? I mean, the core script is located at example.com/index.php , that rewrites stuff to example.com/nl/ .. - Geert 2012-04-04 11:17
I would not recommend you to touch live website. Better hire someone.. - Roman Newaza 2012-04-05 12:37


1

You will need to set the /nl/ directory as root for your .nl Domain.

2012-04-04 08:05
by Fabian Pirklbauer


-1

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]
2012-04-04 08:07
by sarnold
I would never use RewriteEngine for this task - Roman Newaza 2012-04-04 08:09
@Roman: Oh? How would you recommend to not break existing published URLs - sarnold 2012-04-04 08:10
FallbackResourc - Roman Newaza 2012-04-04 08:12
@Roman: 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 should be left intact, so it will work as before. Plus, you can use Alias. Many options. Personally, I don't use Rewrite Module at all - Roman Newaza 2012-04-04 08:51
But .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
No, no, I meant .com/nl/ should still be resolvable while you add new hostname and edit URLs on the pages - Roman Newaza 2012-04-04 08:57
Ads