Aug 19

How to enable or allow htaccess file on apache server

Here we will learn How to enable or allow htaccess file on apache server to override your default server configurations. But before that we will quickly see what is htaccess file.

What is htaccess file?

How to enable or allow htaccess file on apache server

How to enable or allow htaccess file to override your default server configurations

htaccess is a hypertext access file using which web master can override the Apache server default configurations as per their requirement.

Such modifications of default configurations are applicable on directory in which .htaccess file is resides and on all the succeeding directories.

But before you start writing any code in .htaccess file you have to confirm whether this file has permission to override the default configuration or not.

Now a days almost all hosting provider already allowed the permission to .htaccess file to override the server default configurations for the web masters.

But if you owned a dedicated server and you are the owner of apache services installation then you need to do some modification in Apache server configuration file (i.e., httpd.conf) to allow .htaccess file to override you server’s default configurations.

So here are the step to allow .htaccess file to override server configurations
Step 1: Find and open server configuration file(may be httpd.conf or apache2.conf)
For Windows:
- Open local drive in which apache installed
- Go to \apache\conf\ or go to \xampp\apache\conf
- Find file httpd.conf and open in editor
For Fedora Core, CentOS, RHEL:
- Go to /etc/httpd/conf/
- Find file httpd.conf and open in editor
For Debian, Ubuntu:
- Go to /etc/apache2/
- Find file apache2.conf and open in editor
- For more help on finding server configuration file follow the link

Step 2:  Search for below line of code in above file.
AllowOverride None
replace the above line by
AllowOverride All

Step 3: Restart apache/httpd services
In linux: service httpd restart

Step 4: Now you must able to override you server default configurations using .htaccess file

Hope above helps :)

Jul 15

PHP – remove empty values from array

PHP – remove empty values from array

An easy and quick way to remove the empty value keys from an array is given below.

Lets assume below is our array
$array = array(‘data1′,”,’data3′,’data4′);

Now if we print this array using below code
echo “<pre>”;
print_r($array);
echo “<pre>”;

Result:
Array
(
    [0] => data1
    [1] =>
    [2] => data3
    [3] => data4
)
Now we pass the array that is $array to the below array_filter() function like below:

Case1: To Remove NULL values only:
$array = array_filter($array, ‘strlen’);

Case2: To Remove False Values:
$array = array_filter($array);

and then print the array again then we will get array like below
Array
(
    [0] => data1
    [2] => data3
    [3] => data4
)

So from above you can see the empty value removed from the array.

You can test the above examples with following arrays to get more clear idea

$array = array(‘data1′,”,’data3′,’data4′);
$array = array(‘data1′,0,’data3′,’data4′);
$array = array(‘data1′,true,’data3′,’data4′);
$array = array(‘data1′,false,’data3′,’data4′);

Aug 16

Check whether the WordPress environment loaded or not

In most of of the time while we are writing a plugin and doing some AJAX call into this we often including wp-load.php file. It is obvious that to access the WordPress core functions we need to established the WordPress environment. But some time it also happened that WordPress environment is already established though we are including the file which lead to decrease our site performance. So now the question is Check whether the WordPress environment loaded or not Continue reading

Aug 16

How to make placeholder work in IE browser

As we all know that HTML 5 placeholder attribute is not working in IE less than 10 version. If you have input elements in your DOM with placeholder attribute and access the page in IE browser less than 10 version then you will get an error message that placeholder is not defined. To resolve this issue you have to use javascript or jQuery. I have attached a sample code file please download and check it out in different browser. Sample Code

Jul 28

BuddyPress Members Import FAQ

BuddyPress Members Import FAQ

#1 How to install BMI?
- Upload BuddyPress Members Import Directory to the /wp-content/plugins/ directory
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Go to Users tab there a BuddyPress Members Import menu will be present click on it.

#2 How to create CSV file?
- Open your favorite editor write your comma separated values there.
- Now do Save as the same file and save the file in CSV format. Continue reading

Apr 20

Full Forms of some famous name

Yahoo – Yet Another Hierarchy of Officious Oracle
Computer – Commonly Operating Machine Particularly Used for Technology Entertainment and Research
ISRO – Indian Space Research Organisation
NASA – National Aeronautics Space Administration
Virus – Vital Information Resources Under Seize
PSD – Photoshop Document (Photoshop Standard Document)
PDF – Portable Document Format (Adobe PDF)
AJAX – Asynchronous JavaScript and XML
Oracle – Oak Ridge Automatic Computer and Logical Engine Continue reading

Apr 20

How to stop a AJAX call before calling the same again

Some time we want to show auto search results just underneath the auto search box. After each character write into the text box we want to get the result from the database related to the characters present in search text box and for that we have to do AJAX call. In this case if someone wrote 4 characters then 4 ajax call will be fired and from all these ajax calls last response will be taken as a search result. Sometime it may not be correct. Because sometime before fired Ajax call can give response after the later fired ajax call, in this case we may have inconsistent data. And to solve this issue we have to abort the previously fired ajax calls. Now the question is How to stop a AJAX call before calling the same again? Below sample code will solve this problem. Continue reading

Apr 17

WordPress Security Increase

wordpress security increase
To reduce the attack to your WordPress site you can follow the below instructions

1: Increase Security from htaccess file

Add the below code to your htaccess file and replace the xxx.xx.xx.xxx with your IP. IP of your system from which you want to login to your site admin section.

<Files>
order deny,allow
deny from all
allow from xxx.xx.xx.xxx
</Files>

2: Change credentials

Change admin username and password to at-least 10 characters long with combination of all possible type character.
Like: W!w@1)*&<?lkiJH Continue reading

Apr 05

How to show External RSS Feed post on Your WordPress Site

How to show External RSS Feed post on Your WordPress Site? Dont you have time to write post and want to show post from other site’s RSS feed on your site. No worry here is a quick solution for the.

<?php
//Include feed.php file
include_once(ABSPATH.WPINC.'/feed.php');
$rss = fetch_feed('http://feeds.feedburner.com/NdtvNews-TopStories');
$maxitems = $rss->get_item_quantity(5);
$rss_items = $rss->get_items(0, $maxitems);
?>
<ul>
<?php
if ($maxitems == 0)
echo '<li>No items.</li>';
else // Loop through each feed item and display each item as a hyperlink.
foreach ( $rss_items as $item ) :
?>
<li>
<a href='<?php echo $item->get_permalink(); ?>'
title="<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>">
<?php //Get title
echo $item->get_title(); ?>
</a>
<?php //Get description
echo $item->get_description(); ?>
</li>
<?php endforeach; ?>
</ul>