Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

multiple hosts- common redirect

Avatar

Avatar
Level 1
harshaperfect
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
harshaperfect
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile
harshaperfect
Level 1

19-08-2019

I have a requirement related  to /etc/mapping .

i have around 60+ domains in following format:

/etc/map.publish/https/

                    ->domain1

                    ->domain2

                    ->domain3

                    ->domain4

                     ->domain.....

is there a way to write a common redirect rule for all domains instead of adding same redirect to all 60?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile
Gaurav-Behl
MVP

20-08-2019

use different regex for level 2 domains vs level 3 domains

refer- https://regex101.com/  or https://regexr.com/

Answers (4)

Answers (4)

Avatar

Avatar
Level 1
harshaperfect
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
harshaperfect
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile
harshaperfect
Level 1

20-08-2019

Oh thanks for the input.

I have something like this

    www.Domain1.com

     Abc-stage-64.net

     Www.Domain2.com

      Abc.Com

Individual redirect is working so i believe i am doing something wrong in regex.

Avatar

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile
Gaurav-Behl
MVP

20-08-2019

It won't work because $1 would always be null. Who is responsible to feed into $1 for "sling:match"?  You can't have a $1 in "sling:match" in a normal use case.

Please share a couple of sample urls for which you need the regex.

Avatar

Avatar
Level 1
harshaperfect
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
harshaperfect
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

0 solutions
View profile
harshaperfect
Level 1

20-08-2019

Hi Gaurav,

Thanks for the response. I tried

sling:match : "$1/etc[.]clientlibs/(.+)

sling:internalRedirect : /etc.clientlibs/$2

but this is not working. can you suggest any other way?

Avatar

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile
Gaurav-Behl
MVP

19-08-2019

Try

/etc/map.publish/https/

                         my_domain

                                        sling.match   String    (.+).domains.com(/.*.html)$    --- best possible regex that you can come up with for all domains, this one is for subdomains...

                                       sling:redirect or sling:internalRedirect  ...........

Modify regex per your use case, you may require multiple rules for assets and/or libs as applicable