You have a website say example.com, you want it only to be accessed by www.example.com, instead of both example.com & www.example.com or you may want your domain to be only accessed by example.com instead of both example.com & www.example.com.

What is www and why should I redirect to my preferred domain? 

Well here's the answer: Www is actually a subdomain of your domain. www actually refers to [world wide web] hmm! well than why redirect? The best answer is both the domains might have same content i.e. yourdomain.com and www.yourdomain.com, and its not very good to the search engine bots.

What should I choose? www or non-www domain?

This is completly depended upon you and the name of your domain. Sometimes domains are quite good without www for example https://letsencrypt.org.
The domain with or without www does'nt effects search engine optimization (SEO).

1. Redirect your website from non-www to www  i.e. example.com to www.example.com

Configure your nginx server in this way:
Just add this at starting of your site config file which is generally located at: /etc/nginx/sites-enabled/yourdomain.com

server {
listen 80;
server_name yourdomain.com;
return 301 http://www.yourdomain.com$request_uri;
}

Change `yourdomain.com`  with your domain.
This code returns a 301 Redirect to the clients browser and forces to load content from `www` version of your website

If you are using apache2 as your server add the following content to .htaccess file on root of your project. We will use Rewrite Engine Module of apache2 for doing this.
Note: if you don't have .htaccess file, create one!

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

2. Redirect your website from www to non-www  i.e. www.example.com to example.com

Configure your nginx server in this way:
Just add this at starting of your site config file which is generally located at: /etc/nginx/sites-enabled/yourdomain.com

server {
listen 80;
server_name www.yourdomain.com;
return 301 http://yourdomain.com$request_uri;
}

Change `yourdomain.com`  with your domain.
This configuration will make the client redirect to non-www version of website.

For apache2 add this to the .htaccess file in the root of your project/website folder.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


Thank you for reading this article hope you liked it. Will be back soon with another article.

Hello Developer | Reader | Creator | Explorer!

I was going through cloud servers on Internet, as it becomes very difficult to manage everything on shared hosting.

Amazon AWS is one of the providers of cloud services, which has a scheme of pay as you use. Amazon AWS includes a lot many web servirces like, Api Gateway, SNS(Mobile Messaging), S3(Strorage), etc.
AWS has almost all those reuirements which a developer would require.

And also the best part is Amazon AWS gives 12 months free access to its web services.

In this post we will discuss about creating an Account on Amazon AWS and setting up with cloud on EC2 (a service of amazon aws which provides cloud computing).

Amazon EC2 cloud computing, that includes a public ip and a free domain(domain would be somthing like ec2-bla-bla.bla-bla.amazonaws.com)

Follow these steps to create Amazon Account:-

  1. Create a amazon AWS account go here https://aws.amazon.com/ on top left click on sign in to console. After doing that you may be asked for billing information. Fill in that becasue it is required to veirfy your account, it charges Rs. 2 (In India) for the account verification.
  2. After completing that  you will be dropped into your dashboard. On top right corner you will be seeing your Name and just next to that you will see a dropdown of Server Region. Click on that and change to your desired server location. It is recommened that you choose a location which is nearer to your target customers's location. Like for India select Asia Pacific (Mumbai).
  3. On top you have black coloured navigation menu from where you can easily navigate to desired service's(dashboard) or docs. From their go to Compute > EC2
  4. Next you will be able to see your EC2 Dashboard. Here you will be able to see number of instances (i.e. Hosted Clouds), number of volumes (i.e. storage drives), etc. you will get familiar with all of them as soon as you start exploring. Click on launch instance.
  5. Next you have to choose an Image/OS to begin with I will choose ubuntu for now.
  6. After that select free tier option which will have 1 Gb Ram 1 cpu. Then click on review and launch. you can review other configurations add storage if you want. Then you continue.
  7. Next you will get a dialog box where you will be asked to create a key pair. Select create a new key pair add name to it and then click on download. With this key you can access shell of your cloud via ssh. For e.g. ssh -i 'yourkey.pem' ubuntu@ec2-bla-bla-bla-bla.amazonaws.com!
  8. You are done! setting up your cloud.
Great now you can install apache2 or nginx and then you can point your domain to your public ip of your cloud(you will find public ip on instances). Now you are done!

Thank you for reading this post, Share if you like it.
Today I wasted almost 3 hours to search on internet about Multi Authentication in Laravel 5.2. I have gone though laracast's post and other few forums too, I was still not able to find any solution for it. Their were packages such as sboo/multiauth, ollieread/multiauth, kbweb/multiauth etc. yet was not satisfied with their solutions, I tried to use them a lot but very soon I got stuck with bugs.

Finally after a long research I finally found out a great solution for it, i found it on a frequent website I visit for my solution of any coding problems, and the solution was really shocking for me that it required no package installation or any other kinda stuff. It's already included with Laravel 5.2.

Thanks to Hasmukh Tank a stack overflow user, he made a beautiful step by step procedure to do that.
Here are those procedures:
Refer Url : How to use multi Auth in laravel 5.2

1. First we create two models

1) user, 2)admin


2. Update the config/auth.php file:


return [
    'defaults' => [
        'guard' => 'user',
        'passwords' => 'user',
    ],

    'guards' => [
        'user' => [
            'driver' => 'session',
            'provider' => 'user',
        ],
        'admin' => [
            'driver' => 'session',
            'provider' => 'admin',
        ],
    ],
    'providers' => [
        'user' => [
            'driver' => 'eloquent',
            'model' => 'App\User',
        ],
        'admin' => [
            'driver' => 'eloquent',
            'model' => 'App\Admin',
        ],
    ],
    'passwords' => [
        'user' => [
            'provider' => 'user',
            'email' => 'auth.emails.password',
            'table' => 'password_resets',
            'expire' => 60,
        ],
        'admin' => [
            'provider' => 'admin',
            'email' => 'auth.emails.password',
            'table' => 'password_resets',
            'expire' => 60,
        ]
    ]
];



3. Now modify the app/Http/kernel.php file


    protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
        \Illuminate\Session\Middleware\StartSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class
    ];

    protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class      
        ],
        'api' => [
            'throttle:60,1',
        ],
    ];


4. Create LoginController and set below code in it.

Note: You have to create login pages for 'user' as well as 'admin'. And submit login form requests to appropriate controller function i.e. userLogin() or adminLogin().



namespace App\Http\Controllers;

use Auth, Input;
use App\User;
use App\Admin;

class LoginController extends Controller
{
    public function userLogin(){
        $input = Input::all();
        if(count($input) > 0){
            $auth = auth()->guard('user');

            $credentials = [
                'email' =>  $input['email'],
                'password' =>  $input['password'],
            ];

            if ($auth->attempt($credentials)) {
                return redirect()->action('LoginController@profile');
            } else {
                echo 'Error';
            }
        } else {
            return view('user.login');
        }
    }

    public function adminLogin(){
        $input = Input::all();
        if(count($input) > 0){
            $auth = auth()->guard('admin');

            $credentials = [
                'email' =>  $input['email'],
                'password' =>  $input['password'],
            ];

            if ($auth->attempt($credentials)) {
                 return redirect()->action('LoginController@profile');                     
            } else {
                echo 'Error';
            }
        } else {
            return view('admin.login');
        }
    }

    public function profile(){
        if(auth()->guard('admin')->check()){
             pr(auth()->guard('admin')->user()->toArray());
        }         
        if(auth()->guard('user')->check()){
            pr(auth()->guard('user')->user()->toArray());
        } 
    }
}

Every programmer must be aware of node.js servers. Node.js is a modern server framework that lets developer to build applications using Javascript on server side under V8 Javascript runtime environment, hmm cool enough! Well we got lot stuff forward.

Things to know about node:
1. Real time Web Applications
2. Non Blocking Code
3. Event Based Programming
4. Event Loop

Google Chrome uses the v8 javascript runtime in client side. so then node.js wraps this runtime and provides additional functionalities that helps you to develop network applications.

"Node.js  is writtent in c"

As node.js is very fast you can do stuffs like file upload server, websocket server (realtime content to websites). Now why node.js is fast to know that, well you need to read further for that.

What's Non Blocking Code & Blocking Code?
Let's take an example of file upload server, normally how your file upload works. Let's write a pseudocode for that.

- Read file from client and receive it to server
- Process file do some stuff with the file
- Then do something else

Here in this case the server waits for the file to be uploaded and then waits till its done, then it moves further to do other stuff.
Now in case of node.js this is done something like this.

- Read file from client
    - has a callback method which informs file upload, and also do stuffs with chunks of bytes received by client.
- Do other stuff

In this case you see that the server application can receive files as well as do other stuff parallely, and at the same time you can also do process your file.

Event Loop

The event loop model diagram says how actually node.js works with events. Node.js event loop waits for the event to trigger from both server side and client side and then request a specific callback to perform respective task.

Refer : http://www.codeschool.com

Thank You for reading my article, do come again for further part of this tutorial and other programming guides.



I am here with my brand new trick for all my friends, who always think of their GF/BF has gone offline to him/her and avoiding him/her. So I am here to teach you how to find and figure this out.

Now 1st read the requirements before continuing:
You will require Android 2.1 or above to continue with this.
Now if you are in a problem which is in my case also that you dont have any gadget with android OS. I have installed Bluestacks Android App Player for PC. This software let's you run android apps on your Laptop/PC.
Download Bluestacks Click here.
Note: Bluestacks require atleast 1GB Graphics Card to run this software, 1GB Ram and minimum 3GB hard drive space.


Install Facebook Messenger on your gadget or Bluestacks.
Now select your friend who has gone offline to you, or you think he/she gone offline to you, if he/she is online you will see active now written below the name. See on picture
Click on image to zoom.
                            

If he/she was online few hours/minutes ago you will see something like this.
Click on image to zoom.
This trick is 100% working in my case.
Now please dont drag me in if your BF/GF is online and gone offline to you and not repling to your messages, I am not at all responsible for this.
ThankYou for reading this article.... and sorry to those who avoided their GF/BF by going offline to them. hehehehehe. !Sorry!
Best of luck....


Follow the Steps Given Below: Scroll Down To see the download link!



:TO DOWNLOAD THE KEYGEN CLICK BELOW:


CLICK TO DOWNLOAD


Dont forget to share this article!!!
And Like us On Facebook. https://www.facebook.com/hackurworld



!!!!SICK OF THIS ERROR!!!!
Completely Remove this error from your windows. Download this tool which fixes this problem. Its as simple:
  • Download this tool.
  • Extract it from compressed rar file.
  • Disconnect ur Internet and Close all your windows. (Don't forget to save your documents because this tool automatically restarts your PC.)
  • Now run RemoveWAT tool which you just extracted.
  • Sit back wait for system Restart and Yeah! your Windows works fine and perfect. You cracked your copy of Windows 7.
CLICK TO DOWNLOAD THIS CRACK/TOOL