Thursday, February 13, 2014

Disable FTP Server (proftpd) in Plesk

I don't need proftpd on my root server, I use sftp, so:

vi /etc/xinetd.d/ftp_psa

change

disable         = no

to 

disable         = yes


Thursday, November 28, 2013

Monday, March 25, 2013

Delete empty mails from maildrop

I don't know why I have a bunch of empty mails on maildrop folder of postfix, but ...

find /var/spool/postfix/maildrop/ -size 0 -name '*' -exec rm {} +

Postfix. Delete some mails from the queue

Change "123@example" to something you need ...

mailq|grep '123@example'|awk {'print $1'}|grep -v "(host"|tr -d '*!'|postsuper -d -

Wednesday, October 17, 2012

PHP session timeout cookie lifetime


There are many ways to set cookie based session timeout in PHP. You can edit your php.ini or put it in .htaccess but I choose for today this piece of code:

<?php
ini_set('session.gc_maxlifetime', 172800);
ini_set('session.cookie_lifetime', 172800);
session_start();
?>

The session above will be valid for 2 days.

Thursday, September 27, 2012

Redirect all pages to new domain


This code in .htaccess does redirect all requests to a new domain:

RewriteEngine On
RewriteRule ^(.*)$ http://WWW.NEW-DOMAIN.COM/ [R=301]

The problem was, all other directives work like: 

www.old-domain.com/bla -> www.new-domain.com/bla

but I need


www.old-domain.com/bla -> www.new-domain.com

www.old-domain.com/more/bla -> www.new-domain.com

So the htaccess code above works fine.