How to redirect your site to HTTPS

As you may already know google wants all websites to have SSL security installed.
But if you just install https then it will create 2 versions of the same site and this is not good for your search rankings. Therefore you have to redirect all your HTTP URLs to HTTPS.

You can achieve this by editing your .htaccess file

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://www\.yourdomain\.com%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^yourdomain\.com[NC]
RewriteRule (.*) https://www\.yourdomain\.com%{REQUEST_URI} [R=301,L]


Redirect index.php to domain name

Add the following line to .htaccess file. and change yourdomain text.
This will add a permanent redirection to index.php

RewriteCond %{HTTP_HOST} ^yourdomainname\.com\.au$ [OR]
RewriteCond %{HTTP_HOST} ^www\.yourdomainname\.com\.au$
RewriteRule ^index\.php$ “http\:\/\/www\.yourdomainname\.com\.au\/” [R=301,L]

Find out most used mailing script location in your linux server

login to server via SSH

and copy and paste the following command

grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F”cwd=” ‘{print $2}’ | awk ‘{print $1}’ | sort | uniq -c | sort -n

This will give you a list of locations and number of emails sent

200 /home/useraccount/public_html/about-us
360 /home/useraccount/public_html

how to redirect your website from non www to www

As for Google having your domain available in both www and non-www is not recommended. ( and http://
Google see this as content duplication. Yes I know. We thought Google will be smart enough to figure this out.
Well nothing much we can do but do as they say.

Here’s how you do it:

There should be a file call .htaccess In your public_html folder. If you don’t have one you can create one.

Add this lines of code:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] 

And upload the file to server.

That’s it you are done.

wildcard subdomain SSL certificate not working on a shared IP

I have installed a wildcard SSL certificate using WHM but when ever i enter it took me to the But if i use it goes to the correct directory.

After searching in google i found out that it’s a SSL configuration error. When you install a SSL you will have to reconfigure the
certificate for the subdomain.

You can find the solution here :

This is correct post

You can install a wildcard SSL onto the main shared IP, but it will end up installing as the user nobody and have to be manually modified to change it if you want to have additional subdomains on the SSL certificate.

The modification would be in /var/cpanel/userdata/nobody location to copy the existing *.domain.com_SSL to /var/cpanel/userdata/username location (replacing username with the actual username for the domain account), then changing it to match the subdomain name and modifying the paths to the user and changing nobody to the username.

Here’s an example of what the /var/cpanel/userdata/nobody/*.mydomainisgreat.com_SSL file would look like that needs modified:

documentroot: /home/username/public_html
group: nobody
hascgi: 1
homedir: /usr/local/apache/htdocs
ip: #
owner: root
phpopenbasedirprotect: 0
port: 443
serveralias: "*"
servername: "*"
ssl: 1
sslcacertificatefile: /usr/share/ssl/certs/*
sslcertificatefile: /usr/share/ssl/certs/*
sslcertificatekeyfile: /usr/share/ssl/private/*
sslengine: 'on'
usecanonicalname: 'Off'
user: nobody

The lines needing changed would be these:

group: nobody
homedir: /usr/local/apache/htdocs
user: nobody

Sometimes, the documentroot: line also needs changed if it isn’t pointing to that user’s /home/username/public_html path.

The nobody user would be changed to the username for the cPanel account with the subdomain, while the homedir would be /home/username instead.

So, let’s say you have as the subdomain needing the wildcard SSL on the great cPanel username account, you’d do:

cp /var/cpanel/userdata/nobody/*.mydomainisgreat.com_SSL /var/cpanel/userdata/great/pandas.mydomainisgreat.com_SSL

Then in the copied file, you’d change it to the following:

documentroot: /home/great/public_html/pandas
group: great
hascgi: 1
homedir: /home/great
owner: root
phpopenbasedirprotect: 0
port: 443
serveralias: ""
servername: ""
ssl: 1
sslcacertificatefile: /usr/share/ssl/certs/*
sslcertificatefile: /usr/share/ssl/certs/*
sslcertificatekeyfile: /usr/share/ssl/private/*
sslengine: 'on'
usecanonicalname: 'Off'
user: great

At that point, you’d then save the file, copy Apache as a backup, rebuild Apache configuration and restart Apache:

cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak101013
/etc/init.d/httpd restart

That’s how you get a wildcard subdomain SSL certificate working on a shared IP when installed for the user nobody. You should then be able to do the same for any subdomains on that domain on other accounts so long as you modify the paths and user properly for each.


if you don’t know how to find that file to edit. You should login to SSH using putty or similar software and navigate.

some use full unix commands

Edit file;

edit /pathtothefile/filename

cp : copy a file 
cp filename filename.backup : copies filename to filename.backup
cp -a /home/burst/new_design/* /home/burst/public_html/ : copies all files, retaining permissions form one directory to another.
Good luck







How to Remove Unnecessary Space Between lines in Dreamweaver

Sometimes you get awful lots of line spacing after you download a file from the server.
It’s really annoying to delete one by one and it takes your valuable time do that. I was searching for a easy way to fix this and found a solution in the following forum.

This is how you do it (as for nico_swd’s post)

  1. Open the file
  2. Click CTRL + F
  3. Select “Current document” in “Find in” (You can also select the folder if you have multiple files)
  4. Search in “Source code”
  5. Tick “Use regular expression”
  6. Type “[\r\n]{2,}” (without quotes) in “Find”
  7. Type “\n” (without quotes) in “Replace”
  8. Press “Replace All”

Adobe Dreamweaver CS3 Crashing all of a sudden?

All of a sudden my Dreamweaver CS3 started to crash.

After searching in Dreamweaver support forums I found out that there is a bug in Dreamweaver time modification and editing functions.

Then I realise We (Australia) had our clock set to daylight saving time during the weekend.  


This is how you fix it

Close Dreamweaver.

Go to (On Vista) C:\Users\<your username>\AppData\Roaming\Adobe\Dreamweaver 9\Configuration

And delete WinFileCache-AD76BB20.dat file

Open the Dreamweaver.


It should work.



How to develop a page search function in php

This function is developed using simple php. This will not work in dynamic contents because it’s searches the file; line by line in the server end. If you have a website with lots of static html pages I think you will find this very useful. One of the down side is even if you have a html comment in the file it’ll search that as well.


HTML Form:

<form action=”test_search.php” method=”post” name=”d”>
<input name=”send” type=”hidden” value=”1″ />
<input name=”term” type=”text” />
<input name=”submit” type=”submit” value=”submit” />


PHP Code:


//this fucntion is used to get the tile tag of the page
function get_title($a,$b,$c){
$y = explode($b,$a);
$x = explode($c,$y[1]);
return $x[0];


//if form is submited do the following

if ($handle = opendir(‘/path to your directory/’)) { //example path  /home/site-user-name/public_html/my-folder/
 // lets loop over the directory.
 while (false !== ($file = readdir($handle))) {
     if ($file != “.” && $file != “..”) {
   $page= ‘myfolder/’.$file;
   $page= file ($page);
   $numtlines = count ($page); //Number of lines in the file
   $line = 0;
   while ($line < $numtlines) {
    if(stristr ($page[$line], ”.$_POST[‘term’].”)){ //found a match

     //let’s get the page title
     echo ‘<br><a href=”http://www.url-to-your-file/’.$file.'”>”‘.get_title(file_get_contents(‘http://www.url-to-your-file/’.$file), “<title>”, “</title”).'</a><br>’;
     $metatagarray = get_meta_tags(‘http://www.url-to-your-file/’.$file);
     echo $description = $metatagarray[ “description”];
     $line = $numtlines;