ocpsoft / rewrite

OCPsoft URL-Rewriting Framework
http://ocpsoft.org/rewrite/
Apache License 2.0
189 stars 86 forks source link

Question: Redirect to customers webpage #365

Closed rider87 closed 1 year ago

rider87 commented 1 year ago

Hi all, First of all, this is a question - not a bug. But the forum exists not anymore / it was only spam.

I would like to know how I can do this scenario: I have an application with many users. Each user can implement his own website which will be than at url:

For user1:

Same for user2:

My enduser will now use his own website url, means for user1. To the customer from user1 will not see that this customerportal is hosted at https://myapp.com, so he thinks the webpage his hosted on the user1 website (https://user1.com) https://myapp.com/customerportal/**user1**/page1.xhtml -> https://user1.com/customerportal/page1.xhtml

Is this possible? And if yes, how can I implement it? The problem which I currently see the "dynamic" username, like user1, user2...because it´s not a static page. How can I set this parameter?

So my idea would be, that the user will define his "endpoint page" url in my app. E.g. to "https://user1.com/customerportal/" And now my app will map all pages after https://myapp.com/customerportal/**user1**/ to https://user1.com/customerportal/

Many thanks

lincolnthree commented 1 year ago

Questions like this are probably best asked on StackOverflow, but for this, you would use the Domain config element: https://github.com/ocpsoft/rewrite/blob/main/config-servlet/src/main/java/org/ocpsoft/rewrite/servlet/config/Domain.java#L51

Let me know if that helps?