if ($_SERVER['HTTP_HOST'] == 'wwwserver') { ?>
<base href="http://wwwserver/midominio/"/>
<?php
}
else { ?>
<base href="https://www.midominio.com/"/>
<?php
}
Mostrando entradas con la etiqueta Variables del servidor. Mostrar todas las entradas
Mostrando entradas con la etiqueta Variables del servidor. Mostrar todas las entradas
Variables servidor: Host
$_SERVER: Variables del servidor
Para que se vaya a la raiz del servidor:
EJ) http://www.uno.com/dos/tres/pepe.php
Detectar si está bajo https:
$_SERVER['DOCUMENT_ROOT']
EJ) http://www.uno.com/dos/tres/pepe.php
echo $_SERVER["SERVER_NAME"]; // www.uno.com
echo $_SERVER["PHP_SELF"]; // dos/tres/pepe.php
echo $_SERVER["REQUEST_URI"]; // pepe.php
$IP_REMOTA = $_SERVER["REMOTE_ADDR"];
$IP_PUBLICA = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
$IP_INTERNA = $_SERVER['SERVER_ADDR'];
$nav = $_SERVER['HTTP_USER_AGENT']; // navegador
$DNS = gethostbyaddr($IP);
Detectar si está bajo https:
if (!isset($_SERVER["HTTPS"])) { ?>
<script>location.href = "https://www.midominio.com<?=$_SERVER["PHP_SELF"];?>";</script>
<?php
}
Suscribirse a:
Entradas (Atom)
