Skip to main content
Solved

Can different URLs to be linked to multiple companies in the same tenant?

  • December 24, 2024
  • 1 reply
  • 35 views

robk20
Jr Varsity II
Forum|alt.badge.img

We have a prospective client who has two companies that will be setup in the same tenant. 

Can they have separate URLs mapped to the different companies?

(example: CompanyA.Tenant1.com mapped to CompanyA and and CompanyB.Tenant1.com mapped to CompanyB)

Best answer by darylbowman

If you’re willing to get down and dirty with a URL modification tool like IIS Url Rewrite, you may actually be able to. I’ve use it to redirect http to https, but that’s it.

Here’s what Gemini had to say (I can’t verify the validity, but with my limited experience, it seems plausible):

Yes, you can modify a URL in the following format to change the CompanyID parameter using an IIS URL rewrite rule. Here's an example of how to achieve this:

XML

<rule name="Change CompanyID" stopProcessing="true">
  <match url="^Main" />
  <conditions logicalGrouping="MatchAll">
    <add input="{QUERY_STRING}" pattern="CompanyID=(.*?)&amp;?" />
  </conditions>
  <action type="Rewrite" url="Main?CompanyID=NewCo&amp;{R:1}" />
</rule>

Explanation of the rule:

  • name: This attribute specifies a friendly name for the rule, which helps identify its purpose.
  • stopProcessing: This attribute set to true indicates that IIS should stop processing any further rewrite rules after this rule fires.
  • match url: This element defines the pattern that the URL must match for the rule to be applied. In this case, the rule only applies to URLs that end with "Main".
  • conditions: This element defines a set of conditions that must be met for the rule to be applied. Here, the condition checks if the query string contains the parameter "CompanyID" followed by any characters (.*?) and an optional ampersand (&amp;).
  • {QUERY_STRING}: This refers to the entire query string portion of the URL.
  • pattern: This attribute specifies the regular expression pattern to match against the query string.
  • action type="Rewrite": This element specifies that the URL should be rewritten based on the provided URL string.
  • url="Main?CompanyID=NewCo&amp;{R:1}": This attribute defines the URL that the matched URL will be rewritten to. Here, "CompanyID" is set to "NewCo", and the captured value from the matched pattern ({R:1}) is appended to the query string using &amp;.

How it works:

  1. When a URL like https://erp.com/Main?CompanyID=Deft+Strokes+Development+Co&ScreenId=AR3010PL is accessed, the URL rewrite module checks the rules.
  2. The first rule matches because the URL ends with "Main".
  3. The condition also matches because the query string contains "CompanyID".
  4. The URL is rewritten to https://erp.com/Main?CompanyID=NewCo&ScreenId=AR3010PL. In this case, "Deft+Strokes+Development+Co" is replaced with "NewCo" in the "CompanyID" parameter, and the remaining parameters are preserved.
View original
Did this topic help you find an answer to your question?

1 reply

darylbowman
Captain II
Forum|alt.badge.img+13
  • 1742 replies
  • Answer
  • December 26, 2024

If you’re willing to get down and dirty with a URL modification tool like IIS Url Rewrite, you may actually be able to. I’ve use it to redirect http to https, but that’s it.

Here’s what Gemini had to say (I can’t verify the validity, but with my limited experience, it seems plausible):

Yes, you can modify a URL in the following format to change the CompanyID parameter using an IIS URL rewrite rule. Here's an example of how to achieve this:

XML

<rule name="Change CompanyID" stopProcessing="true">
  <match url="^Main" />
  <conditions logicalGrouping="MatchAll">
    <add input="{QUERY_STRING}" pattern="CompanyID=(.*?)&amp;?" />
  </conditions>
  <action type="Rewrite" url="Main?CompanyID=NewCo&amp;{R:1}" />
</rule>

Explanation of the rule:

  • name: This attribute specifies a friendly name for the rule, which helps identify its purpose.
  • stopProcessing: This attribute set to true indicates that IIS should stop processing any further rewrite rules after this rule fires.
  • match url: This element defines the pattern that the URL must match for the rule to be applied. In this case, the rule only applies to URLs that end with "Main".
  • conditions: This element defines a set of conditions that must be met for the rule to be applied. Here, the condition checks if the query string contains the parameter "CompanyID" followed by any characters (.*?) and an optional ampersand (&amp;).
  • {QUERY_STRING}: This refers to the entire query string portion of the URL.
  • pattern: This attribute specifies the regular expression pattern to match against the query string.
  • action type="Rewrite": This element specifies that the URL should be rewritten based on the provided URL string.
  • url="Main?CompanyID=NewCo&amp;{R:1}": This attribute defines the URL that the matched URL will be rewritten to. Here, "CompanyID" is set to "NewCo", and the captured value from the matched pattern ({R:1}) is appended to the query string using &amp;.

How it works:

  1. When a URL like https://erp.com/Main?CompanyID=Deft+Strokes+Development+Co&ScreenId=AR3010PL is accessed, the URL rewrite module checks the rules.
  2. The first rule matches because the URL ends with "Main".
  3. The condition also matches because the query string contains "CompanyID".
  4. The URL is rewritten to https://erp.com/Main?CompanyID=NewCo&ScreenId=AR3010PL. In this case, "Deft+Strokes+Development+Co" is replaced with "NewCo" in the "CompanyID" parameter, and the remaining parameters are preserved.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings