Why do some websites add “Slugs” to the end of URLs? [closed]
The slugs make the URL more user-friendly and you know what to expect when you click a link. Search engines such as Google, rank the pages higher if the searchword is in the URL.
The slugs make the URL more user-friendly and you know what to expect when you click a link. Search engines such as Google, rank the pages higher if the searchword is in the URL.
That a character is reserved within a generic URL component doesn’t mean it must be escaped when it appears within the component or within data in the component. The character must also be defined as a delimiter within the generic or scheme-specific syntax and the appearance of the character must be within data. The current … Read more
Well there are two methods to access this data easier, but the interface doesn’t offer the possibility to get the whole URL with one call. You have to build it manually: public static String makeUrl(HttpServletRequest request) { return request.getRequestURL().toString() + “?” + request.getQueryString(); } I don’t know about a way to do this with any … Read more
If you want to get the value after the hash mark or anchor as shown in a user’s browser: This isn’t possible with “standard” HTTP as this value is never sent to the server (hence it won’t be available in $_SERVER[“REQUEST_URI”] or similar predefined variables). You would need some sort of JavaScript magic on the … Read more
I recently wrote a URL encoder, so this is pretty fresh in my mind. http://site/gwturl#user:45/comments All the characters in the fragment part (user:45/comments) are perfectly legal for RFC 3986 URIs. The relevant parts of the ABNF: fragment = *( pchar / “/” / “?” ) pchar = unreserved / pct-encoded / sub-delims / “:” / … Read more
The query component is indicated by the first ? in a URI. “Query string” might be a synonym (this term is not used in the URI standard). Some examples for HTTP URIs with query components: http://example.com/foo?bar http://example.com/foo/foo/foo?bar/bar/bar http://example.com/?bar http://example.com/?@bar._=???/1: http://example.com/?bar1=a&bar2=b (list of allowed characters in the query component) The “format” of the query component is … Read more
Form data (for GET or POST) is usually encoded as application/x-www-form-urlencoded: this specifies + for spaces. URLs are encoded as RFC 1738 which specifies %20. In theory I think you should have %20 before the ? and + after: example.com/foo%20bar?foo+bar
We had a situation where we needed to persist the URL hash across ASP.Net post backs. As the browser does not send the hash to the server by default, the only way to do it is to use some Javascript: When the form submits, grab the hash (window.location.hash) and store it in a server-side hidden … Read more
Valid to the URI RFC Likely acceptable to your server-side framework/code The URI RFC doesn’t mandate a format for the query string. Although it is recognized that the query string will often carry name-value pairs, it is not required to (e.g. it will often contain another URI). 3.4. Query The query component contains non-hierarchical data … Read more
EDIT: As @Jukka K. Korpela correctly points out, RFC 1738 was updated by RFC 3986. This has expanded and clarified the characters valid for host, unfortunately it’s not easily copied and pasted, but I’ll do my best. In first matched order: host = IP-literal / IPv4address / reg-name IP-literal = “[” ( IPv6address / IPvFuture … Read more