Snippets

How to Enable Root Login to Google Cloud vis SSH

To enable Root Login to Google Cloud, Please follow these instructions.

Open SSH configuration file

nano /etc/ssh/sshd_config

Enable Root login and Password Authentication.

PermitRootLogin yes 
PasswordAuthentication yes

Restart SSH server

systemctl restart sshd

Set root password if not set already

 passwd root 
Read more
adminHow to Enable Root Login to Google Cloud vis SSH

How to redirect a Web URL

There are different methods to redirect a Web URL or Page to a different URL or Page. Redirection cab be done using HTML , JavaScript,  Apache or PHP.

In this post we will look at all different ways.

HTML redirect

Using meta refresh tag of HTML.

 <meta http-equiv="refresh" content="0;URL='http://example.com/'" />    

PHP redirect

Using PHP header function. Its sends a 302 redirect. Its must be used at top of page before any HTML tag or PHP code.

 <?php header('Location: http://www.example.com/'); ?> 

JavaScript redirect

window.location object can be used to redirect to any URL ot page.

 <script> window.location.replace("http://www.example.com/"); </script>

jQuery redirect

 <script> $(location).attr('href', 'http://www.example.com/') </script>

Apache .htaccess redirect

 Redirect permanent /oldurlorlocation.com http://newurl.com

There are many ways to redirect in JavaScript and jQuery. There are most commonly used methods.

Read more
adminHow to redirect a Web URL

How to Autoplay a YouTube video in Iframe embed

By Default a YouTube Iframe embed code don’t auto play a video  when embedded on a web page.

It can be auto played by simply adding this URL parameter in URL of video.

autoplay=1

So, The iframe code for a YouTube video which auto play when embedded on a page is

<iframe width="640" height="360" src="https://www.youtube.com/embed/LIn3tYCRZhk?rel=0&amp;autoplay=1" frameborder="0" allowfullscreen></iframe>

 

Read more
adminHow to Autoplay a YouTube video in Iframe embed