The "host" HTTP header is set by the client to indicate the virtual host that should be used to fulfil the request.
Questions tagged [http-host]
70 questions
0
votes
1 answer
.htaccess: rewriteCond to another page within same URL with params
I've an condition for my .htaccess for crawlers and search engines which takes them to a "static" page where they can scrape all content.
Up until now I've had my domain {client}.realdomain.com where {client} is a subdomain for one client.
When the…

Emil Devantie Brockdorff
- 4,724
- 12
- 59
- 76
0
votes
0 answers
Lightsail Configure Apache's HTTP_HOST
I have an instance hosted using AWS Lightsail's LAMP stack. I also have a hostname on Godaddy.
$_SERVER['HTTP_HOST'] is returning 127.0.0.1:8000 where the application is running. Is there anyway to configure Apache so that this returns the hostname?

ray
- 85
- 1
- 1
- 5
0
votes
1 answer
iis 8 url rewrite https and www
I need to make the following redirects and I can't get the last one:
http://www.example.com
http://example.com
https;//example.com ** Not working - get 404
all have to go to:
https;//www.example.com
(Note: the semicolons are actually colons)
The…

CDenby
- 95
- 2
- 6
0
votes
1 answer
How to make 'www' optional in a Hostname Route in Zend?
Let's say I have the domain "example.com"
I would like to add a route such as when the URL is "example.com/whatever/follows" it redirects to "http://www.example.com/whatever/follows" (forwarding the query strings too).
Basically I would like to…

Tibor Vass
- 157
- 14
0
votes
1 answer
get the host the user is coming from
i wanted to know in python how can i get the host the user came from?
how do i extract it?
i tried this:
host = self.request._environ['HTTP_HOST']
but it's empty...
Do you have any idea what it should be
Thanks.

arik
- 71
- 1
- 3
0
votes
1 answer
Seeing if $_SERVER["HTTP_HOST"] contains a string fails on wordpress functions.php
I want to create a function on my functions.php that checks whether I'm on a local setup (url is http://macbook.local:5757/) or a live server (example.com).
Here is my code:
$server = $_SERVER["HTTP_HOST"];
if (strpos($server,'macbook') !== false)…

Jonathan
- 697
- 3
- 13
- 24
0
votes
3 answers
http_host with and without www
I have a message to appear in PHP if the domain going to is outside some existing ones already redirecting to the account.
For example, the command I am trying to run if the domain is www or non www is:
if( $_SERVER[ 'HTTP_HOST' ] != ('xxx.co.uk' &&…

Palemo
- 217
- 1
- 5
- 19
0
votes
2 answers
Htaccess if HTTP_Host then send 403
Exist a way in Htaccess to say If HTTP_HOST = my.subdomain.com Then block access (403) for the files .php and .html?
I want that the only files accessible throug my subdomain are Images.

user2136749
- 31
- 3
0
votes
2 answers
get full url link with language prefix in wordpress
I want to get the language prefix from url with Wordpress, but I don't know how.
if I have the following url http://sitename.com/ru/about-us, I want to get the full path including /ru/, but whatever I try i don't get it ,e.g …

Anna Gabrielyan
- 2,120
- 3
- 28
- 48
0
votes
1 answer
How to prevent SERVER['HTTP_REFERER'] switches to the calling page?
Please help.
A link obtained by using $_SERVER['HTTP_REFERER'] in form.php like this:

Aldilno Jinjalo
- 31
- 5
0
votes
1 answer
Why %{HTTP_HOST} doesn't work while HTTP_HOST literal string works?
I have the next Apache code to prevent hotlinking, and it works.
RewriteCond %{HTTP_REFERER} ^$ [OR]
RewriteCond %{HTTP_REFERER} !^https?://itransformer.*$ [NC]
RewriteRule /usuarios/.*\.(gif|jpe?g|png|wbmp)$ - [R=404,L]
The questions are…

Manolo
- 24,020
- 20
- 85
- 130
0
votes
1 answer
Keeping original HTTP_HOST when Redirecting/Rewriting
I am experiencing an issue with the IIS Rewrite Module and nopCommerce.
Situation:
I have several domains (Domain1.ca, Domain2.ca, etc.), each redirecting to a main domain (MainDomain.ca) at the Registrar level (using a CNAME record). Is it…
0
votes
2 answers
How to get http host in ZF 1.12
How can I get the host address?
For example, my site is located here: http://example.org/index/news/
and I want to extract only http://example.org/.
I ask about ZF function. I know about $_SERVER['HTTP_HOST'] but I'm looking for something native.

Paweł Zegardło
- 298
- 3
- 10
0
votes
2 answers
Checking empty request uri with .htaccess
I need to redirect the request from
www.mysite.com/?querystring=data
to
www.mysite.com/dir/phpfile.php/?querystring=data
It means that it should be translated only the url with empty request_uri ( for example
www.mysite.com/css/style.css…

Antonio Giovanni Schiavone
- 902
- 4
- 14
- 30
0
votes
1 answer
mod_rewrite based on current HTTP_HOST and HTTP_REFERER
Is it possible to make such check with htaccess mod_rewrite -
If a referer domain is example.com and current host is www.example.com
then redirect the user to example.com domain.
The meaning is to keep the user at first visiting domain (www or…

user2398504
- 1
- 1