Reputation: 166
I want to redirect a if URL match defined strings using .htaccess in a single line code
If URL is
Redirect URL
I tried this but i want to define string (e.g. books, mobiles, books) instead of (.*)
RewriteRule ^(.*)/xyz/?$ upcoming/index.html [NC,L]
Upvotes: 1
Views: 117
Reputation: 101
Don't know if i've understand correctly the question, but this should do the trick:
RewriteRule ^mobiles|books|computers/xyz/?$ upcoming/index.html [NC,L]
Tested on https://regex101.com/
Upvotes: 2