.htaccess detect string after slash

1

I'm not getting htaccess to detect string or characters after / for example.

I have this:

xpto.xpto / xx /

And I wanted it when this happened

xpto.xpto / xx / cualquecoisa

.htaccess internally executes a php code

I tried this but without success

RewriteEngine on 
RewriteRule ^(.*)/xx/$ https://www.google.com/ [L] 
    
asked by anonymous 15.03.2016 / 17:55

1 answer

2

Your Regex does not contemplate what you want.

She says that she can have anything but must end with /xx/ . And what you want is anything + / xx / + anything .

That would be like this: (.*)/xx/(.*) .

I personally do not find this kind of Regex good, as it's not clear enough. So the only thing it says is that it should contain /xx/ .

Being able to accept:

xpto.xpto/xx/qualquecoisa/xx/qualquecoisa
xpto.xpto/xx/xx/
xpto.xpto/xx//xx/
    
15.03.2016 / 18:05