1

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]

1 Answer 1

2

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/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.