Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am unclear if an anchor tag should come before a query string or after.

http://www.domain.com/search?query=hello#name

or

http://www.domain.com/search#name?query=hello

Or does it matter?

share|improve this question
up vote 33 down vote accepted

Best practice is to append the named anchor at the end. The technical name is a fragment identifier, and the syntax is in RFC 3986.

The RFC section is here: http://tools.ietf.org/html/rfc3986#section-4.1

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

Wikipedia actually covers it well:

The fragment identifier introduced by a hash mark # is the optional last part of a URL for a document

share|improve this answer
    
Cheers @iivel! Section 3 was more helpful for me (section-4.1 seems specific to relative URIs) as I debated this with someone. – eebbesen May 19 '15 at 19:03
    
What about webserver, does it need to handle it during serving page ? – ray pixar May 17 at 12:12
    
@raypixar URL fragments are not sent to the server – Juan Mendes Jul 7 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .