Loading your website from a subdirectory

By placing the following code in your .htaccess file  in the root folder you can load your main site from a subdirectory.

RewriteEngine on

# Edit example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$

# Edit 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/subdirectory/

# Don't change these line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Edit 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /subdirectory/$1

# Edit example.com to be your main domain again.
# Edit 'subdirectory' to be the directory you will use for the main domain.
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ subdirectory/index.html [L]

Paste image from clipboard into browser

// window.addEventListener('paste', ... or
document.onpaste = function(event){
    var items = (event.clipboardData || event.originalEvent.clipboardData).items;
    console.log(JSON.stringify(items)); // will give you the mime types
    var blob = items[0].getAsFile();
    var reader = new FileReader();
    reader.onload = function(event){
        console.log(event.target.result)}; // data url!
    reader.readAsDataURL(blob);
}

Source: stackoverflow.com

Ignore Directories in mod_rewrite

A quick piece of code for you. If you are using mod_rewrite and you have actual, real folders on the site as well, you don’t want requests for items in those folders to be rewritten. You need a way to prevent the RewriteRule(s) matching the real folders.

A quick way to do this is by adding a RewriteRule for each of the real folders, like the below. This rule will match any request to those folders and prevent it being rewritten later in the set of rules.

RewriteRule ^folder_name/.*$ - [PT]

Source: www.addedbytes.com

Installing GD library using CPanel

 

If you need to enable imagecreatefromjpeg on CPanel hosting, then do the following…

  • Go to WHM -> Software -> EasyApache
  • If prompted to upgrade, do so then repeat the above step
  • Begin customizing based on the current provile
  • Proceed through the screens until you get to “Step 5″
  • On “Step 5,” click on “Exhaustive Options”
  • Under PHP, check the checkbox for GD
  • Proceed with Build & Compile Process

Source: http://forums.cpanel.net/f5/how-instal-gd-library-114941.html