I have an issue similar to this question Redirect URLs with a # in .htaccess

I'm trying to access Magento 2 api at /rest/all/V1/products/sku. This works for majority of products but some have a # symbol in their structure ie #123456 or #98754. I keep getting a Bad request returned form the server.

I'm unsure how to format the rewrite rule I wish to pass it through to the api but retain the # symbol. the Requested is created by Restsharp.

Rewritecond %{HTTP_HOST}/rest/all/V1/products/
RewriteRule #(.+)$ #$1 [L,NE]
RewriteRule \x23(.+)$ #$1 [L,NE]
  • How does your question differ from the points discussed in the linked question? What URLs exactly are you trying to rewrite from/to?
    – MrWhite
    Jan 15 '20 at 16:13
  • 1
    think I've managed to resolve by changing # to %23 when compiling the request string. tried this before but it never worked..but testing again now and it is returning the correct json
    – user107834
    Jan 15 '20 at 16:14
  • Glad you got it resolved. You should add that as an answer (and later accept it) to possibly help other readers and to remove the question from the unanswered question queue. Thanks.
    – MrWhite
    Jan 15 '20 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.