1

I'd like to customize the URL of a current web application. For example the current default landing page is

https://somedomain/index

Now I need to customize the URL based on the user company. For example if the company is ABC then the URL would be

https://abc.somedomain/index

OR

https://somedomain/abc/index

And for this company I want to apply a custom CSS`

How can I achieve this ?

5
  • How many such subdomain will you have? Commented Nov 25, 2015 at 13:22
  • Can I have it like a lot ? Maybe few thousands. Is there such setting can map any subdomains to a fix IP ? Then in the web app I tried to apply css based on the subdomain name. Commented Nov 25, 2015 at 13:26
  • And you will also have thousands of css files? Commented Nov 25, 2015 at 13:27
  • Yes. I need to provide a customized CSS for each company. Any better suggestion ? Commented Nov 25, 2015 at 13:29
  • Updated the question. Commented Nov 25, 2015 at 13:33

1 Answer 1

3

Well what I'm writing here is not the best solution. But, I think it will satisfy what you are trying to do.

My strong suggestion is to find a better way of doing this.

<c:set var="serverName" value="${ pageContext.request.serverName }"></c:set>
<c:set var="split" value="${ fn:split(serverName, '.') }"></c:set>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="resources/css/${split[0]}.index.css">

this should get compile to

if http://abc.domain.com/

<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="resources/css/abc.index.css">

if http://xyz.domain.com/

<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="resources/css/xyz.index.css">
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. By the way, do I have to manually create the subdomains too ? Can I map something like *.subdomain to a fix IP ?
Yes, you can. I've tried it in godaddy. I'm sure others will let you do the same too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.