0

I'm facing url (hash) redirecting issue in my angular application. I tried fixing it with angular way but it doesn't work so I go with custom .htaccess way. This solution is working fine but I'm facing issue with (duplicate) URL(s) which have hyphen(s). Example below.

.htaccess

RewriteEngine On
RedirectMatch 301 ^/terms    http://example.com/#terms
RedirectMatch 301 ^/terms-bb http://example.com/#terms-bb

As per above example if open "http://example.com/terms-bb" it redirects to "/terms" instead. So is there any way that I can strictly match these duplicate urls?

1
  • 3
    You only anchored your patterns at the start there, so ^/terms matches on anything that starts with /terms. If you want a strict match, then anchor it at the end as well – ^/terms$. Commented Jun 22, 2021 at 7:12

1 Answer 1

1

You only anchored your patterns at the start there, so ^/terms matches on anything that starts with /terms.

If you want a strict match, then anchor it at the end as well – ^/terms$.

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.