Categories
PHP Useful

Add and Remove Query String Variables in PHP – The Easy Way

PHP offers two functions that are very useful for us in generating or modifying a link: parse_str – automatically converts all query parameters into an array http_build_query – generates a URL-encoded query string from the associative (or indexed) array Below is a function that can help you add, delete or modify a parameter in a […]

Categories
Linux Security Useful

How to Change default SSH Port 22 to Increase Security

By default, the SSH service runs on port 22, but to prevent automated robots and malicious users from brute-forcing into your server, you should consider changing the default 22 SSH port with another randomly selected one.. To prevent incorrect server configuration, you should choose a port from the range of dynamic / private ports (i.e., […]

Categories
Servers Useful

HTTP headers used by Cloudflare when operating as a Reverse Proxy

CF-IPCountry – This header contains the country code of the home visitor, it is a two-character value that will contain the country code, if the country is unknown, it will be “XX” True-Client-IP – Provides the IP address of the client (visitor) for each request to the source, CloudFlare adds the True-Client-IP header. Cloudflare always […]

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’])) { […]

Categories
Servers Useful

How to use Cloudflare CF-IPCountry Hader in .htaccess !

The CF-IPCountry header is specific only to those who use Cloudflare in “Proxied” mode, so if you do not use Cloudflare, then this article is not useful! 1). How to block traffic from specific countries using CloudFlare If for any reason you want to block visitors from any country, the solution is extremely simple and […]

Categories
Linux Useful

Convert Subtitles SRT from ISO-8859-16 to UTF-8 – iconv – Linux

On the current personal NAS server, which is more like a Media Server for a Home Theater, I installed Jellyfin instead of more “popular” but not one of the most suitable for Home Media Center, such as Open Media Vault, or Amahi. The current configuration replaced an older server for which I used OMV (Open Media […]

Categories
Linux Useful

How to Remove Files Recursively using Wildcard? – Linux Command Line

A short time ago I had to delete a lot of files created by a script, which I didn’t need anymore, but those files were scattered all over the disk, in many folders and subfolders. After scouring the whole internet, reading all sorts of scripts and commands, I finally found a close solution, which I […]