How to redirect everything to HTTPS

Redirect all non-HTTPS traffic to HTTPS using htaccess

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTPS} !on [NC]
 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

for more htaccess tips, go to this url:

How to configure virtual hosts on Apache on Windows

If you are using Apache on your Windows machine and want to set up virtual hosts so you can type something like this “www.myDomain.tst” in your browser and it’ll direct you to your local hosted site … you have to edit this file:


Add a new line with this text  myDomain

Open apache\conf\extra\httpd-vhosts.conf file and add these lines:

<VirtualHost *:80>
DocumentRoot path_to_your_document_root
ServerName myDomain

Free DNS

There are a number of free DNS that you can use:

  • Google’s
  • Quad9’s
  • CloudFlare’s
  • OpenDNS
  • Norton
  • CleanBrowsing
  • Comodo DNS

Here is a good article comparing DNS for speed and features

For the speed results, The Top 5 DNS are:

Global Average Speed:

  1. CloudFlare: 4.98 ms
  2.  Google: 16.44 ms
  3.  Quad9: 18.25 ms
  4.  CleanBrowsing: 19.14 ms
  5.  Norton: 34.75 ms


How to send variable to wherehas function in Laravel

If you need to send variable to wherehas function , all you have to do it to use “use” .. here is an example…

To list the Users whom their posts are in certain langue .

$language = 3;
$users = Users::whereHas('posts', function ($query) use($language){
                    $query->where('language_id', $language);

Download a file using command line in Windows

If you want to download a file using only command line, you can create a batch file (.bat) with the following :


@Echo OFF
SetLocal EnableDelayedExpansion
powershell.exe -Command (new-object System.Net.WebClient).DownloadFile('', 'C:\destination\test.txt')

Of course you have to change the source and destination according to your needs.

The only problem is that running this file will open the command prompt for few seconds .. to avoid that you can create a VBscript file (.vbs) that will run the batch file in the background without the appearance of the command prompt.


Set oShell = CreateObject ("Wscript.Shell") 
Dim strArgs
strArgs = "cmd /c download.bat"
oShell.Run strArgs, 0, false

Important article about future of the web apps

Here is a good article about the web apps and how it is going better. Mainly talking about PWA (Progressive Web App) , WEBASSEMBLY and HOUDINI

How to center google map to current location using javascript

To center google map to current user location using js api, you first have to make your website a HTTPS site

if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function (position) {
        var pos = {
            lat: position.coords.latitude,
            lng: position.coords.longitude
    }, function () {
        console.log('error gis');

more details here

Laravel storage can’t be accessed

To be able to access Storage folder, you have to create a link:

php artisan storage:link

In case your are using a shared hosting and can’t access the SSH , then you can run the phpartisan from route or controller


Here is an example of running phpartisan from route

Route::get('artisan/command/{key?}', array(function ($key = null) {

        if ($key == "cache - clear") {
            try {
                echo' < br > php artisan cache: clear…';
                Artisan::call('cache: clear');
                echo' < br > php artisan cache: clear completed';
            } catch (Exception $e) {
                Response::make($e– > getMessage(), 500);
        elseif($key == "view - clear") {
            try {
                echo' < br > php artisan view: clear…';
                Artisan::call('view: clear');
                echo' < br > php artisan view: clear completed';

            } catch (Exception $e) {
                Response::make($e– > getMessage(), 500);

        }elseif($key == "link") {
            try {
                echo' < br > php artisan storage link';
                echo' < br > php artisan storage:link completed';

            } catch (Exception $e) {
                Response::make($e– > getMessage(), 500);

        }else {



Also you can try running symlink() function

    $res = symlink('/home/pylonsof/public_html/darwinSource/storage/app/public','/home/pylonsof/public_html/darwin/storage');
?><span id="mce_marker" data-mce-type="bookmark" data-mce-fragment="1">​</span>