Latest Event Updates

Change the current document root to a new directory inside the current one using .htaccess

Posted on

The scenario is as follows. Client is having a website mydomain.com which is the primary domain of the cpanel account. Now the user want to redirect all the traffic coming to the current document root (/home/username/public_html) to the new_folder created (/home/username/public_html/new_folder/) for the site. Create a .htaccess file in /home/username/public_html with the below contents :

RewriteEngine on

# Change mydomain.com to be your primary main domain.
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$

# Change 'new_folder' to be the folder you want to redirect request to.
RewriteCond %{REQUEST_URI} !^/new_folder/

# Don't change this line.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d

# Change 'new_folder' to be the folder you want to use for your primary domain.
RewriteRule ^(.*)$ /new_folder/$1

# Change mydomain.com to be your primary domain again.
# Change 'new_folder' to be the folder you will use for your primary domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ new_folder/index.php [L]

It is always recommended to change the document root directly in apache or from WHM rather than using this temporary solution. Still worth to know. :)

Run asterisk commands without entering into the CLI

Posted on

We can run the asterisk commands by entering into the CLI as below :

asterisk -vvvr

you can run the same commands without entering into the CLI as below :

[root@NOCMEConnect ~]# asterisk -rx "sip show peers"
Name/username              Host            Dyn Nat ACL Port     Status
6123                       192.168.22.73    D   N   A  5060     OK (13 ms)
6124                       192.168.22.67    D   N   A  5060     OK (16 ms)
6125                       192.168.22.35    D   N   A  5060     OK (16 ms)

Enjoy :)

MySQLZRM extract the backup to mysql

Posted on

1. locate the backup using the below command :

mysql-zrm-reporter --show restore-info --where backup-set=myhostserver1.com

where ‘myhostserver1.com’ is my host configured for backup
2. Extract the backup to the location /backup/sql/myhostserver1.com/20140604050029/ using the command below :

mysql-zrm-extract-backup --source-directory /backup/sql/myhostserver1.com/20140604050029/ --tmpdir /temporary_location/ 

Enjoy :)

MySQLZRM extract the backup to mysql

Posted on

1. locate the backup using the below command :

mysql-zrm-reporter --show restore-info --where backup-set=myhostserver1.com

where ‘myhostserver1.com’ is my host configured for backup
2. Extract the backup to the location /backup/sql/myhostserver1.com/20140604050029/ using the command below :

mysql-zrm-extract-backup --source-directory /backup/sql/myhostserver1.com/20140604050029/ --tmpdir /temporary_location/ 

Enjoy :)

MySQLZRM extract the backup to mysql

Posted on

1. locate the backup using the below command :

mysql-zrm-reporter --show restore-info --where backup-set=myhostserver1.com

where ‘myhostserver1.com’ is my host configured for backup
2. Extract the backup to the location /backup/sql/myhostserver1.com/20140604050029/ using the command below :

mysql-zrm-extract-backup --source-directory /backup/sql/myhostserver1.com/20140604050029/ --tmpdir /temporary_location/ 

Enjoy :)

MySQLZRM extract the backup to mysql

Posted on Updated on

1. locate the backup using the below command :

mysql-zrm-reporter --show restore-info --where backup-set=myhostserver1.com

where ‘myhostserver1.com’ is my host configured for backup
2. Extract the backup to the location /backup/sql/myhostserver1.com/20140604050029/ using the command below :

mysql-zrm-extract-backup --source-directory /backup/sql/myhostserver1.com/20140604050029/ --tmpdir /temporary_location/ 

Enjoy :)

Redirect a site using html

Posted on Updated on

You can use the below code to redirect a site to http://gopukrish.wordpress.com

<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="1;url=http://gopukrish.wordpress.com">
<script type="text/javascript">
window.location.href = "http://gopukrish.wordpress.com"
</script>
<title>Page Redirection</title>
</head>
<body>

If you are not redirected automatically, follow the <a href='http://gopukrish.wordpress.com'>link to my blog</a>
</body>
</html>

 

Enjoy :)