.htaccess Useful tips

To disable directory Browsing :


# To Disable Directory Browsing
Options All -Indexes

Domain Redirection:

.htacces code for redirecting yourdomain.com to www.yourdomain.com


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

To Hide the Extension:


RewriteRule ^([^/.]+)/?$ $1.html

 

How to do redirection properly using .htaccess

Hey, i think redirection is more important for SEO. Here i would like to share some information related to .htaccess and this may help you.

Using .htaccess file, you can easily configure and redirect Apache Web Server file system.

We may need to set the URL Redirection from OLD one to new One. then we can use the following code in .htaccess file(which is 301 redirect).

Redirect 301 /old.html http://site.com/new.html/

by adding that code in .htaccess, you can do redirection from old url to new url as per your need.

 

How to disable automatic updates in wordpress

4919659112_b9f6b0df8f_o

WordPress Announces the automatic updates from version 3.7 on-wards, and this is for better security.

In WordPress, there are four types of automatic background updates:

  1. Core updates
  2. Plugin updates
  3. Theme updates
  4. Translation file updates

Configuration via wp-config.php

Using wp-config.php, automatic updates can be disabled completely, and core updates can be disabled or configured based on update type.

To completely disable all types of automatic updates, core or otherwise, add the following to your wp-config.php file:

define( 'AUTOMATIC_UPDATER_DISABLED', true );

To enable automatic updates for major releases or development purposes, the place to start is with the WP_AUTO_UPDATE_CORE constant. Defining this constant one of three ways allows you to blanket-enable, or blanket-disable several types of core updates at once.

define( 'WP_AUTO_UPDATE_CORE', false );

Hope this help….!

Solving get_available_shipping_methods() method errors

woothemes-ninja-logo-brand

The error looks something like this (the full path and line number may be different):

Fatal error: Call to undefined method WC_Shipping::get_available_shipping_methods() in .../wp-content/themes/THEME-NAME/woocommerce/checkout/review-order.php on line 14

This issue is caused by your theme, they are bundling outdated template files in their themes that have been deprecated for a while now. You should contact the theme developer to get this fixed properly. You can delete that specific file from your theme until this issue has been patched by your theme developer for a temporary fix. WooCommerce will fall back on the default template file, bundled with the plugin.

Variable products won’t add to cart – Woocommerce Upgrade Issue

woothemes-ninja-logo-brand

I have seen that still there some theme having bundled with old files for the add to cart template being used for variable products, adding a variable product to cart fails. This should be solved by the theme developers by updating the template file.

In order to solve this woocommerce upgrade issue, the quick solution is to delete the below mentioned file from the theme directory.

/woocommerce/single-product/add-to-cart/variable.php

This will make WooCommerce use the new bundled template file and your variable products will add to cart again. Once your theme developer updates your theme, please check if it actually works as that will overwrite this change again.

Best WordPress Plugin for your website – Must

4919659112_b9f6b0df8f_o

Hey, here i m going to introduce some plugins which is a must for your site. I hope this will help someone who search for better wordpress performance. I always use the best wordpress plugins for my projects, because they will have best support and documentations so that it will help us to use with ease.

Akismet (For Spam Filtering)

Hope you all heard about spam issue in wordpress, Akismet is the best solution to the spam issue. Akismet helps to reduce almost all spams. Continue Reading…

How to show breadcrumb navigation to wordpress

Step 1: Include the below function in the functions.php

function the_breadcrumbs() {
    if (!is_home()) {
        echo '<a href="';
        echo get_option('home');
        echo '">';
        bloginfo('name');
        echo "</a> » ";
        if (is_category() || is_single()) {
            the_category('title_li=');
            if (is_single()) {
                echo " » ";
                the_title();
            }
        } elseif (is_page()) {
            echo the_title();
        }
    }
}

Call this above function where you wish to show the breadcrumb

<?php the_breadcrumbs(); ?>

How to change the Add to cart message

woothemes-ninja-logo-brand
/**
 * Custom Add To Cart Messages
 * Add this to your theme functions.php file
 **/
add_filter( 'woocommerce_add_to_cart_message', 'custom_add_to_cart_message' );
function custom_add_to_cart_message() {
	global $woocommerce;
 
	// Output success messages
	if (get_option('woocommerce_cart_redirect_after_add')=='yes') :
 
		$return_to 	= get_permalink(woocommerce_get_page_id('shop'));
 
		$message 	= sprintf('<a href="%s" class="button">%s</a> %s', $return_to, __('Continue Shopping &rarr;', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') );
 
	else :
 
		$message 	= sprintf('<a href="%s" class="button">%s</a> %s', get_permalink(woocommerce_get_page_id('cart')), __('View Cart &rarr;', 'woocommerce'), __('Product successfully added to your cart.', 'woocommerce') );
 
	endif;
 
		return $message;
}

How to disable Woocommerce tab feature

 /**
 * Remove product tabs
 *
 */
function woo_remove_product_tab($tabs) {

    unset( $tabs['description'] );      	// Remove the description tab
    unset( $tabs['reviews'] ); 			// Remove the reviews tab
    unset( $tabs['additional_information'] );  	// Remove the additional information tab

 	return $tabs;
 
}
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tab', 98);