2

I want create one Drupal 8 website (one database) with changing contents depending of the URL the user used, I mean:

  • If the user goes to the main URL http://foo.com, the main page of the website is loaded and contains some content generated for the http://foo.com URL
  • If the user goes to the main URL http://faa.com, the main page of the website is loaded and contains some content generated for the http://faa.com URL

I can manage that with Apache settings. But how can I configure Drupal? If a user uses the URL http://foo.com and then, he goes to the subpage /test, the URL must become http://foo.com/test.
But, if a user goes to the site with the URL http://faa.com and then, he goes to the subpage /test, I want the base URL still http://faa.com (http://faa.com/test).

2

I've handled this situation very easily by setting two different Apache VirtualHost with the same DocumentRoot.

The thing you have to be very careful is the page caching of Drupal. I recommend you to read the Cache Context document on Drupal 8 who is very helpful for your situation. By passing the "url" cache context on your different render arrays, you will prevent the content of a URL to be displayed on the other.

Drupal routing system doesn't take the domain name. So there'll be no problem and a user who go on a subpage from a domain name will stay on this domain name.

| improve this answer | |
2

This sounds like a perfect job for the Domain Access module.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.