10/28/2014

How to keep ssh alive on centos

By default, the SSH servers are set to disconnect clients who has been inactive or idle after a certain period of time. In order to keep the ssh session alive, you may configure the ssh server.

You may change the ClientAliveInterval, TCPKeepAlive and ClientAliveCountMax options in the sshd configuration file. After you config your ssh, please do not forget to restart your ssh server.

#sudo vi /etc/ssh/sshd_config

ClientAliveInterval 100
TCPKeepAlive  yes
ClientAliveCountMax  99999

#sudo  /etc/init.d/sshd restart


10/05/2014

htaccess to redirect to different domain name

In order to implement direction for different domain on htaccess, please use the following configuration.

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^aaaa/([0-9]+)\.html$ /index.php?action=A&sid=$1 [QSA,L]
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^bbbb/([0-9]+)\.html$ /index.php?action=B&sid=$1 [QSA,L]