Virtual Configurationhost

1

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

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

When accessing meusite.com.br/app , it redirects to the first core of the list that is set to a .xhtml file, so anywhere in the country always redirects to AC .

I need to create a configuration, that when the user accesses /app , go to a page so he can select the kernel he wants to access, in that case it would be /escolherestado .

I need the /app redirection to continue existing because the whole application depends on this redirection, more precise than whenever personnel access meusite.com.br/app or /app/ is redirected to /escolherestado without /app/[sigla_nucleo] "being affected.

    
asked by anonymous 21.02.2017 / 13:59

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)

The above regex captures the string mysite.com/app in capture group 1 (the first parentheses).

(\/{0,1})

This part defines that there can be / at the end of the string. Home It is surrounded by other parentheses, as the substitution will only be with capture group 1

(?!.{1})

The end is a negative lookahead , it defines that the string should not be caught if there is any character other than a line break at the end of the catch, so it will not catch% Home After that, a substitution group for group 1 should be used to add the end.
You should then use /app/[sigla_nucleo] (group 1 captured without the slash at the end: myite.com/app ) and add $1 .

$1\/escolherestado

Forming meusite.com.br/app/eschoherestado

    
11.08.2017 / 01:45