Categories
PHP Useful

Get last URL after following HTTP redirections in PHP – get_headers

1st. step: Disable https/ssl verify & set some headers … $context = stream_context_create( [ ‘ssl’ => [ ‘verify_peer’ => false, ‘verify_peer_name’ => false, ], ‘http’=>array( ‘max_redirects’=>10, ‘ignore_errors’=>0, ‘method’=>”GET”, ‘header’=>”Accept-language: en\r\n” . “Cookie: \r\n” . “User-Agent: Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19\r\n” ) ]); default method is GET, […]

Categories
Security Useful

Secure Your Browser with Secure DNS – DNSSEC, TLS and Encrypted SNI

Well, this is new to many, and for most it is like an alien technology, but this is the future and it is absolutely necessary for the internet, oh, I could say urgently! So what do you need to do to get a better night’s sleep, knowing that your traffic is not “spied on” by […]

Categories
Servers Useful

Automatic HTTPS redirection for HTTP – htaccess,php,html or javascript

1). How to redirect HTTP to HTTPS from .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule> The above code redirects any subdomain not just the base domain. A 301 redirect is a permanent redirect that tell search engines that URL has moved permanently. 2). How to Redirect With PHP if (empty($_SERVER[‘HTTPS’])) { […]