I am attempting to parse hostname only in the Apache server variable HTTP_REFERER and I am wondering whether it's possible with mod_rewrite since let me have the hostname after which rewrite the request.

Your HTTP_REFERER will return the exactly URL that associated with your page, with mode_rewrite or otherwise, it'll return the literal url. So, if it's something.com/foo/index.php or somthing.com/foo/action, the http_referer will cat these web addresses like as appear.

I believed it

RewriteCond %{HTTP_REFERER} ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? [NC]
RewriteRule ^traveler.html$ http://something.com/viewer.html?embed_referer=%4 [QSA,L]

Using the back-reference from RewriteCond, I'm able to append the query string towards the new path/URL.