Skip to main content


Showing posts from September, 2016

Redirect web url to a specific directory using apache

As i am a developer, i have many scenarios where many project will be in a single server but we have different web url. So we need to redirect the http control to a specific project directory based on our web url.

          For example, code is located in  /var/www/html/home while code at /var/www/html/sub directory. This can be done using apache in ubuntu.

Execute below commands to redirect redirect to respective directory.

cd /etc/apache2/sites-available
Now create a conf file named with your url, for example sub.example.conf and add below code to that file,

<VirtualHost *:80>
    DocumentRoot /var/www/html/sub
    <Directory /var/www/html/sub>
        AllowOverride All
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
Save this file and execute below commands sudo a2ensite sub.example.conf
sudo a2enmod rewrite

Build List on scroll - Jquery

Now a days, we have many websites including social networking and commercial sites dynamically building the list based on our scroll. Here i am showing how to build list based on our scrolling in a whole div and on a specific div.

    First of all, we need to write a server side script to give front-end required list. In my example, i am creating ajax.php

array("Amazon", $image_path."/amazon.png"),
array("Apple", $image_path."/apple.png"),
array("Cisco", $image_path."/cisco.png"

Preview Image before Upload

In this blog, i will be showing how to display selected images to upload before upload in your browser.

First of all, we should have input fields of type file to select images from our drives.

<label>Single File:</label>
<inputtype="file"id="fileSingle"name="fileSingle" />
<label>Multiple Files:</label>
<inputtype="file"id="fileMultiple"name="fileMultiple[]"multiple /><