Generate URLs correctly using the query string and hashtag symbol

When both a query string and an anchor tag (hash tag) are visible in the URL, what is the order in which they appear?

http://www.whatever.com?var=val#anchor

or

http://www.whatever.com#anchor?var=val

Are there any documents about this?

update: URLs handled by Wordpress / PHP

+53
standards url php wordpress
02 Oct
source share
3 answers
 ?var=var#hash 

everything after # is the client side.

Also, look at URL rewriting to get rid of the ugly ?var=var

+76
Oct 02
source share

? should appear before # , as specified in RFC 3986 :

 relative-ref = relative-part [ "?" query ] [ "#" fragment ] 

Taken from the answer to the superuser ( https://superuser.com/questions/498617/does-an-anchor-tag-come-before-the-query-string-or-after ):

+26
Jan 13 '16 at 16:57
source share

If the intention to use # means page fragment , then yes ? then # .

If # comes up to ? , and this does not mean that the page is fragment (this can happen when # is part of the permissions (username and password)), it must be encoded or you are in trouble. The same applies to any other special characters ( : , @ , ...) that could give a different meaning to the URL.

+1
Jul 05 '16 at 13:45
source share



All Articles