Secure your wordpress website

Having a blog on wordpress, teaches me how to avoid hackers. Hacking !! yes, as a owner of a blog you may hacked anytime. Hackers are really talented guys, they have very good idea about networking and computer programming. They know the best approach to hack a website in a short time. Doors are made to break but the most durable door is the good one. So it’s better to ensure good security on your wordpress blog, so that the hackers have to spend lot of time to crack it. Usually, they don’t spend long time to hack a website without purpose. Here, I would like to share some good security approaches.

Secure your wordpress website - thinkshifter

 

 

1.  .htaccess file :

Using .htaccess file is a very good practice. wp-config.php is one of the most important files in wordpress. You need to secure this file well. You can change the file permission to 440. Sometimes I get confused when I do a lot of work with wp-config.php file, I forget to change the file permission to 440 after finishing my editing. So I prefer to use the .htaccess file to get rid of mistakes. You can simply add the following codes in .htaccess :

 

<files wp-config.php>
order allow,deny
deny from all
</files>

You should also restrict the hacker to access to wp-include folder by adding the following codes on .htaccess.

# Block the include-only files.
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]

# BEGIN WordPress

 

why you should not use godaddy hosting

Why you shouldn’t use Godaddy Hosting

Godaddy

is very popular for domain name registration gateway but are successful on web hosting business ? The answer is simply “NO”. There are few reasons why you shouldn’t use Godaddy as a webhosting server.

Cost:

Godaddy hosting

are not as cheap as the domain name, they charges more money comparing to other hosting..

Cpanel: Cpanel features are limited and the cpanel organization is aweful. It’s very difficult for someone to handle if he/she hasn’t worked on Godaddy before. I personally experienced a problem while installing wordpress from the application. It took about 30 mins  !! to install and configure wordpress which is automatic. Where other hosting server has “Fantastico”, which will install wordpress  on your own server within a min.

DNS: I personally faced a huge problem in changing DNS, sometimes they take more than 6 hours to change a simple DNS server address.

why you should not use godaddy hosting

Database & FTP: If someone wants to add database or ftp, Godaddy don’t allow those instantly. Everything goes to queue and then they approved it. Normally it takes about 5-8 mins to approve a newly created Database and for FTP it takes about 3-4 mins to Approved, it’s ridiculous !!  On the other hand, every hosting server except Godaddy creates database or FTP within a sec.

Menu Organization: Godaddy Menu organization is a mess. I don’t how they did this kind of complicated menu structure for normal user.

I am using godaddy for about 4 years, I know everything about it. I have already experienced this problem, that’s why I have shared my opinion with you. There are other good hosting in the market like, hostgator, bluehost, rackspace etc.

WordPress 3.5 Dynamic Copyright Text in Footer

It’s one of the most boring jobs to change the copyright text on footer every year as long as the wordpress website exists. Here is a easy solution for this which you need to add the following text in footer.php

<b>(c) 
<?php echo date('Y'); ?>
</b>
| <a href="
<?php bloginfo('url'); ?>
">
<?php bloginfo('name'); ?>
</a>
| 
<?php bloginfo('description'); ?>

 

WordPress Code Snippets – WP_HOME and WP_SITEURL change

WP_HOME and WP_SITEURL need to change, when you have moved the website from one host to another. It’s a very common problem in wordpress but I have modified the code in different way by creating a variable $domain_name.This will only work if you move your website to another hosting root. The following codes should be added to wp-config.php.

$domain_name = $_SERVER[ 'SERVER_NAME' ]; // $domain_name will containt the server domain name 
define( 'WP_HOME', 'http://' . $domain_name );
define( 'WP_SITEURL', 'http://' . $domain_name );

If the website is been move e.g. example1.com to example2.com/test/ .. You need to add the following codes.

$domain_name = $_SERVER[ 'SERVER_NAME' ]; // $domain_name will containt the server domain name 
define( 'WP_HOME', 'http://' . $domain_name . '/test/' );
define( 'WP_SITEURL', 'http://' . $domain_name .'/test/');

 

WordPress Code Snippets – Author bio Snippets

Sometimes we like add authors bio in every blog post. This solution may help to show authors bio on the bottom of the post.

 

Step 1: 

You need to access the theme Directory functions.php file and paste  the following codes on the bottom of all codes. If you paste the code on the bottom, there is will not be any risk to remove or overlapped with other tags.

 

<?php 
function author_excerpt (){ // author_except is the function name
$word_limit = 20; // Here we are limiting the number of word in authors bio
$more_txt = 'read more about:'; // Read more/ Learn more text can be here.
$txt_end = '...'; // Symbols you want to use in the end of the text
$authorName = get_the_author(); // get_the_author() function will call the author name form the database of the associated post.
$authorUrl = get_author_posts_url( get_the_author_meta('ID')); // get_author_posts_url( get_the_author_meta('ID')) this function will grab the url and post of the post where you need the authors bio
$authorDescription = explode(" ", get_the_author_meta('description'));
$displayAuthorPageLink = count($authorDescription);
$word_limit ? $txt_end.' '.$more_txt.' <a href="'.$authorUrl.'">'.$authorName.'</a>' : '' ;
$authorDescriptionShort = array_slice($authorDescription, 0, ($word_limit));
return (implode($authorDescriptionShort, ' ')).$displayAuthorPageLink;
}
?>

Step 2:

 

Now you have to add the following codes to the single page template e.g. single.php / onepage.php; where you want to display the authors bio.

<?php  
if (function_exists('author_excerpt')){echo author_excerpt();} 
?>

 

No valid plugins were found. — SOLVED 100%

Problem: 

“The package could not be installed. No valid plugins were found.”

 

It’s a very common problem. I have wasted about 2 days to solve the problem. I found many people were looking the solve. And most of them failed to do so. Some code of lines can help you to get rid of the problem.

This problem is found in the recent version of wordpress. Which is wordpress 3.5.

Solve:

Please add this code on wp-config.php inside the (<?php ?> ) PHP tag.

define(‘WP_MEMORY_LIMIT’, ’64M’);
define(“FTP_HOST”, “domain name here”);
define(‘FS_METHOD’, ‘ftpext’);
define(‘FTP_BASE’, ‘/’);
define(‘FTP_USER’, ‘ftp username here’);
define(‘FTP_PASS’, ‘ftp password here’);
define(‘FTP_HOST’, ‘localhost’);
define(‘FTP_SSL’, false);

Don’t forget to comment on the post if it solves your problem.