0

Our new URL structure is like below

http://domain.com/#/test?utm_source=test&utm_medium=test

We need to keep # (hash sign) in URL as the application depends upon it but at same time we also need querystring to work but the problem is browsers are skipping querystring from request if URL contain # and application / server not even receiving them.

user553076
  • 133
  • 1
  • 1
  • 8

2 Answers2

0

You can't do that:

https://en.wikipedia.org/wiki/Fragment_identifier The fragment identifier introduced by a hash mark # is the optional last part of a URL for a document. It is typically used to identify a portion of that document. The generic syntax is specified in RFC 3986. The hash mark separator in URIs does not belong to the fragment identifier.

Solutions:

  1. Omit this tag and use hashtags always in this routing place

  2. Use as $_GET param with urldecode

Read this Usage of Hash(#) in URL

Community
  • 1
  • 1
Arkowsky
  • 851
  • 7
  • 19
0

First thing, it will not work; but one thing you can do is, put a javascript code on the page, where you compare the routes & AJAX request to the API ( that returns only data needed ). pseudo code can be,

window.onload = function(){
  if(window.location.hash == "you needed"){
     xhr(url_needed_with_json_or_xml);
  }
}

NOTE: downside is you may need to keep routes in client side js, otherwise go change hash based url routing.

Renjith Thankachan
  • 4,178
  • 1
  • 30
  • 47