Is it possible to get the hostname only from HTTP_REFERER with mod_rewrite?

advertisements

I'm trying to parse hostname only from the Apache server variable HTTP_REFERER and I'm wondering if it's possible with mod_rewrite since my goal is to obtain the hostname and then rewrite the request.


Your HTTP_REFERER will return the exactly URL that linked to your page, with mode_rewrite or not, it will return the literal url. So, if it is something.com/foo/index.php or somthing.com/foo/action, the http_referer will cat these urls like as appear.