Virtualhost configuration

Asked

Viewed 47 times

1

I have a question in the configuration of VirtualHost, I have an application that has redirect to multiple cores ex:

  • meusite.com.br/app/go
  • meusite.com.br/app/rj

When access meusite.com.br/app, it redirects to the first kernel of the list that is configured in a file .xhtml, so from anywhere in the country always redirects to the AC.

I need to create a configuration, which when the user accesses /app, go to a page so that it can select the core you want to access, in case it would be /escolherestado.

I need the redirect /app continue to exist because the entire application depends on this redirection, more accurate than whenever the staff access meusite.com.br/app or /app/ be redirected to /escolherestado without /app/[sigla_nucleo]" be affected.

1 answer

0

To capture the patterns you want, you can use this regex:

(meusite\.com\.br\/app)(\/{0,1})(?!.{1})

And use a replacement group like this:

$1\/escolherestado

You can check the operation of this regex here.

Explanation

(meusite\.com\.br\/app)

regex above captures string meusite.com.br/app in catch group 1 (the first parentheses).

(\/{0,1})

This part defines that there may be /at the end of the chain.
It is surrounded by other parentheses, because the substitution will only be with the capture group 1

(?!.{1})

The end is a Negative Lookahead, it defines that the string should not be captured if there is any character that is not line break at the end of the catch, so it will not capture /app/[sigla_nucleo]

After this should be used a replacement group for group 1, to add the final.
Logo must be used $1 (group 1 captured without the bar at the end: vulgo meusite.com.br/app) and is added /escolherestado.

$1\/escolherestado

Forming meusite.com.br/app/choosestatus

Browser other questions tagged

You are not signed in. Login or sign up in order to post.