How to disable the email alerts for a cronjob

There are 2 ways to prevent cron to send out e-mail notifications once the cron is executed:

01. Simply append one of the following directives to the end of your script to be executed.

so the cronjob will look like the following

* * * * * command /path/to/the/file >/dev/null 2>&1


* * * * * command /path/to/the/file &> /dev/null

Save and close the file. Restart the crond:

# /etc/init.d/crond restart


02. By editing the MAILTO variable in the cronjob

# crontab -e -u username


Save and close the file.

# /etc/init.d/crond restart

Password protection in .htaccess

To password protect a folder by using .htaccess file;

# vi /home/username/.htpasswds/.htpasswd




then create a .htaccess file in respective folder which you want to protect

# vi .htaccess

and add following

AuthUserFile /home/username/.htpasswds/.htpasswd

AuthType Basic

AuthName “Login Details”

Require valid-user

the path depends on the location of the .htpasswd file.

Directory Listing options in .htaccess

If there is no index page in a directory of your website, anyone can see the files in that directory. It’s called as Directory Listing.

1. To Enable/Disable Directory Listing

To have the web server produce a list of files for such directories, use the below line in your .htaccess.

Options +Indexes

To have an error (403) returned instead, use,

Options -Indexes

2. Listing Style

Either a basic list of files can be shown, or a ‘fancy’ list including icons, file size, modification date and more.

IndexOptions +FancyIndexing

Add this to your .htaccess file to use the ‘fancy’ style.

IndexOptions -FancyIndexing

Use the above line if you prefer a more basic file list.

3. Ignore Files

Let’s say you have a directory with .jpg, .gif and .png image files. You only want the .png files to show in the directory listings. Add this line to your .htaccess.

IndexIgnore *.gif *.jpg

The web server now ignores the .gif and .jpg files.

4. Modify Index File

Maybe you don’t want a list of the files, you want a specific file to be shown instead. You could upload an index.html file in this directory. There is another way.

DirectoryIndex myfile.html

Instead of listing the files, web page myfile.html will now be shown for this directory and its sub-directories.

how to set up redirects by using .htaccess

To redirect a to

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]

To redirect a subdomain to

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]

Redirecting a website in PHP

header( ‘Location:’ ) ;

You need to add provided code in your index.php file. it will be redirected to

/bin/rm: Argument list too long.

If you try and use ‘rm -rf’ you’ll generally get this error:

/bin/rm: Argument list too long.

So, let’s do it differently. We’ll use ‘find’ to find every file and pass it only ‘rm’ like so:

find . -type f -exec rm -v {} \;

This will delete the files.

Plesk control panel login error

While accessing the plesk control panel, you may get the following error;

 ERROR: Zend_Log_Exception

“/usr/local/psa/admin/logs/panel.log” cannot be opened with mode “a”

0: Stream.php:66

Zend_Log_Writer_Stream->__construct(string ‘/usr/local/psa/admin/logs/panel.log’)

1: Abstract.php:84


2: Abstract.php:31


3: Abstract.php:19


4: auth.php3:137

To resolve the issue, follow the steps provided below.

[[email protected] ~]# rpm -q psa
[[email protected] ~]# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e"select * from misc where param='version'"
| param | val |
| version | 01090 |
[[email protected] ~]# cat /usr/local/psa/version
10.0.1 CentOS 5 109101029.17
[[email protected] ~]# /usr/local/psa/bootstrapper/pp10.9.0-bootstrapper/ repair
**** Product repair started.
===> Checking for previous installation ... found.
Create user 'psaadm' and group 'psaadm'
Checking for the group 'psaadm'...
Group 'psaadm' already exists
All stages of the upgrade were successful.
psa is now running on your system.
To complete the system configuration process, please proceed to URL: or
Use 'admin' and '<YOUR ADMIN PASSWORD>' as login name and password.
Further, use the following commands to start and stop the system:
/etc/init.d/psa start and
/etc/init.d/psa stop respectively.
===> Removing temporary database backup file /var/lib/psa/dumps/mysql.preupgrade.dump.gz
**** Product repair completed successfully.

You should be able to get the login prompt now.