Category: WordPress

How To Turn Your WordPress Blog From NoFollow to DoFollow Without a Plugin

How To Turn Your WordPress Blog From NoFollow to DoFollow Without a Plugin

In this tutorial, I will show you how to easily turn your WordPress blog from the default NoFollow to a DoFollow blog without the need of a plugin. Why not turn your blog into a DoFollow blog and get more visitors, more traffic and eventualy more recognition in the Online community. Probably you already have seen some blogs displaying the DoFollow image and you wonder how it is done and what it really means. Read my next tutorial for a closer look at DoFollow versus NoFollow.

What are NoFollow and DoFollow?

DoFollow is a term that does not really exist. It is a slang term given to Websites that are not using nofollow. nofollow is a value that can be assigned to the rel attribute of the HTML anchor tag to instruct some search engines not to pass on any influence to an outbound link. The nofollow value was intended to stop comment spam in blogs. Commenting is recognized as a good way to get one way backlinks. But it has been abused and thus the creation of the nofollow value back in 2005.

You might already know that NoFollow blogs do not carry any PR value to other Websites through commenting. If your blog is DoFollow then comments made by your users get Link juice, meaning that your blog passes on the PR value to the commenter.

Should You Set Comment Links To DoFollow?

One way to encourage your readers to comment on your blog is by making your blog DoFollow. If your blog is new and you are trying to increase traffic then you need to turn your blog to a DoFollow blog. When people comment on your content they are adding value to your content. Some consider DoFollow as bribing visitors for comments, while others consider it as rewarding visitors that leave a comment. I tend to agree with the latter, but whatever your opinion is, DoFollow encourages interaction with your readers. One negative side though is that it increases comment moderation duties and an increase of spam comments.

What About a Plugin?

Yes, there are several plugins that turn your blog to a DoFollow blog. But I encourage you to read my previous article about unnecessarily adding plugins to your theme. Also, you really don´t need a plugin for such a simple task.

How does NoFollow and DoFollow Look Like?

The only way to know whether a link has been set to NoFollow is to look at the source code of the page. There are several ways to do that depending on the browser you use. To look at the source code, select “source” from your browser´s menu or you could right click on the page to view the source from the context menu. Also, Mozilla Firefox browser has add-ons that highlights a nofollow link on the page without actually looking at the source code.

The attribute that defines a link as NoFollow is rel=“nofollow”. If you remove the rel=“nofollow” attribute, then your link becomes DoFollow. There is no dofollow value. The absence of the nofollow value makes the link a DoFollow.

A typical DoFollow link is like this:

<a href="https://bacsoftwareconsulting.com" title="">BAC</a>

A typical NoFollow link is like this:

<a rel="nofollow" href="https://bacsoftwareconsulting.com" title="">BAC</a>

Features of My “DoFollow” Code

  1. The code is added to your theme´s functions.php file. The core WordPress code is not modified in any way.
  2. The code is split into 2 independent sections (Section1 and Section2). You have the choice to choose either one or both.
  3. The code is tested to work with the latest version of WordPress. However it also works with earlier versions.
  4. The code is tested to work properly with all major browsers.

“DoFollow” Code | functions.php

To change your Comment links from NoFollow To DoFollow, Open the functions.php file located in your theme´s folder, and add (copy and paste) the following code.

Note: To scroll within the code: You can also click on the code window and use your keyboard´s arrow keys.

<?php
/**** Section1: Changes the author's link in the comment section to a 
'dofollow' instead of the default WordPress  of 'nofollow' ****/
function dofollow_comment_author_link() {
    $url    = get_comment_author_url();
    $author = get_comment_author();
 
    if ( empty( $url ) || ('http://' == $url))
        return $author;
    else
        $link = "<a href='$url' rel='external' class='url'>$author</a>";
        return $link;
}
//http://codex.wordpress.org/Function_Reference/add_action
add_action('get_comment_author_link', 'dofollow_comment_author_link');
/* End of Section1 */
 
/**** Section2: Changes all links in the comment text to a 'dofollow' 
instead of the WordPress default of 'nofollow' ****/
function dofollow_comment_text_link($string) {
    //http://www.php.net/manual/en/function.str-ireplace.php
    $string = str_ireplace('rel="nofollow"', '', $string);
    return $string;
}
//http://codex.wordpress.org/Function_Reference/add_filter
add_filter('comment_text', 'dofollow_comment_text_link');
/* End of Section2 */
?>

“DoFollow” Code Notes:

Note: If you don´t see the horizontal bar, and to scroll within the code, you can also click on the code window and use your keyboard´s arrow keys.

1. Section1 of the above code changes the author´s link in the Comment section to a dofollow instead of the WordPress default of nofollow.

Meaning an Author´s link such as:

<a class="url" rel="external nofollow" href="https://bacsoftwareconsulting.com">BAC</a>

will be transformed to:

<a class="url" rel="external" href="https://bacsoftwareconsulting.com">BAC</a>

2. Section2 of the above code changes all links in the Comment text to a dofollow instead of the default WordPress of nofollow.

Meaning Any link in the Comment text box such as:

<a rel="nofollow" href="https://bacsoftwareconsulting.com">BAC</a>

will be transformed to:

<a href="https://bacsoftwareconsulting.com">BAC</a>

3. You have the choice to apply either Section1 of the code or Section2 or Both. For this Blog, I applied both Sections.

General Warning

When you add several PHP code blocks in your theme´s funtions.php file, make sure that you do NOT leave any white space (spaces, newline) before the opening PHP tag or after the closing PHP tag. Like so (the correct way):

<?php 
//Some Code here beetween the opening PHP tag (above) 
//and the closing PHP tag (below)...
?>
<?php 
//Some other Code here ...
?>

In the above code, if you leave any white space or a newline between lines 4 and 5, you will get the following error: Warning: Cannot modify header information – headers already sent by … , in your login screen and after you login to your WordPress dashboard.

Your Turn to Talk

What is your opinion about NoFollow or DoFollow? Does link juice mean anything to you? How easy did you find this tutorial to implement?

If you have something to say, please share your opinion in the DoFollow Comment section and get your reward. Your opinion matters, unless it is a Spam. By the way, this blog is now a DoFollow blog.

Complete Backup of Your WordPress Website in 2 Simple Steps

Complete Backup of Your WordPress Website in 2 Simple Steps

In this tutorial I will show you a 2 step process for a full backup of your WordPress Website. This is an important task as discussed in Tip3 of my previous tutorial about WordPress Security. This tutorial mainly focuses on manual backups of self-hosted WordPress Websites.

Why Backups are important? Because you cannot depend on your Web host to keep a current backup of your Website. Also, you can protect your Website from crackers by making regular WordPress backups. Making backups is essential because problems inevitably occur and you need to be in a position to recover fast.

A complete WordPress backup is not difficult if you know what to do. Your WordPress Website consists of two parts: Database and Files. Therefore, for a complete backup, you need to backup your WordPress database AND your WordPress Files.

Step1. Backup your Database using phpMyAdmin

Your WordPress Website is powered by a MySQL database which contains all of your content and the settings for your Website. If your database gets damaged or erased your Website would be like an empty shell without content. Your database needs to be backed up separately from your WordPress files.

I strongly recommend that you backup your database regularly and before any upgrades. Restoring your database from a backup is then possible if something goes wrong.

To create a backup copy of your WordPress database, you can do that from your phpMyAdmin Web interface using the Export function. How to do that?

  1. Log into your phpMyAdmin
  2. Select your WordPress database
  3. Click on the Export tab on the top set of tabs
  4. Look at the top left box of the Export section. All the database tables you selected are in that box.
  5. WordPress tables usually start with “wp_” or whatever table_prefix you specified in your wp-config.php file.
  6. If you only have your WordPress blog installed in that database, make sure to “Select All” unless you are making a custom backup for a specific purpose.
  7. Ensure that the SQL radio button is selected.

For the Structure section

Check the boxes as shown in the image below.

For the Data section

Check the boxes as shown in the image below. Complete inserts and Extended Inserts are mostly cosmetic changes to the output style, though Extended Inserts can help if you are having issues with the file size.

  1. Check None for compression. If your database is very large use any compression option.
  2. Keep remember template checked.
  3. Now click Go and save the file to your computer.
  4. You have now backed up your database.

See the image below:

REMEMBER: You have NOT backed up the files and folders (like images, videos, etc.), but all your posts, comments and WordPress settings are now safe.

What does "Add DROP TABLE / VIEW / PROCEDURE / FUNCTION" do?
It will drop (remove) the existing tables before recreating them again. This ensures that the tables creation is successful. If you don´t check this box you may need to drop the tables that you want overwritten before importing the database.

References:

  1. Backing Up Your Database
  2. WordPress Backups
  3. Using phpMyAdmin
  4. phpMyAdmin

Step2. Backup your Files

The database content is not enough for a complete backup, you also need to backup your files. In general a WordPress Website consists of several components:

  1. Core WordPress files
  2. WordPress Plugins and Themes files
  3. Your other specific files (images, videos, audio, custom files, etc.)

All of these components are used to generate your Website. These need to be saved.

Since you can always obtain the core WordPress files from the WordPress Website. At the least you need to backup the wp-content folder and all its content. This folder contains your theme(s), your plugins, all your uploads, and any custom files you have. Besides the wp-content folder, there are 2 other files that you should also copy which are: wp-config.php file and the .htaccess file (if it exists). My advice to you is to also include the core WordPress files. This ensures that you have a complete backup of everything related to the structure of your WordPress installation.

Using an FTP program, such as FileZilla, you should backup your WordPress files by downloading them to a folder on your computer or to an external drive. This step will only work if you have a self-hosted WordPress Website.

Remember that this type of backup does not backup your posts, comments and other associated data. You must also backup your database as discussed in Step1 above. Also keep 3 backups of the files, just in case one gets corrupted or lost, and store them in different places.

References:

  1. Backing Up Your WordPress Files
  2. Using FTP Clients
  3. Using FileZilla

Other Options

The required steps for a complete WordPress Backup are Step1 and Step2 listed above. Here, in this section, I want to give you other alternatives that might help.

WordPress Export Function

This is an XML file that you can save for the purpose of importing it into a new WordPress install. This file is helpful and makes it easier to move your Website hosted in WordPress.com to a self-hosted WordPress installation.

From your WordPress dashboard, go to Tools -> Export and download an XML file of your Website’s content. This file, contains your posts, pages, comments, custom post types, categories, tags, and users. However, with this file you do not get all of your media backed up with it. While it is an easy backup, it is by no means complete. Once the Export file is created, it can be imported using the Tools -> Import SubPanel in WordPress dashboard.

This XML file is not a replacement of your WordPress database backup as discussed in Step1. It does not create your database tables and does not backup your media and structure files as discussed in Step2. Consider this file as an additional, sometimes useful and helpful backup. So you could add this, as I do, to your routine backup strategy.

Automatic Backups

There are few WordPress plugins that automatically backup your WordPress database and some plugins also backup your WordPress files. However, I can´t vouch for any of them because I have not tried them. Feel free to try them and give us your feedback in the comments section. It is much easier for me to take the manual approach, I like to keep plugins at a minimum.

Typical Questions

How often should I backup?

You should backup on a regular basis, daily or weekly depending how active your Website is. Also, if possible, backup to a read-only media to ensure that your files have not been tampered with.

A sound backup strategy includes keeping a set of your entire WordPress installation (WordPress core files and database) in a trusted location. How many backups should I keep?

Most people make one backup and then overwrites it every time. But this is the wrong approach. A rule of thumb is to keep at least three backups and keep them in three different places. My database backup is huge. What can I do?

Often statistics and anti-spam plugins can add large amounts of data to your database. When backing up the database, this information is not important to keep. Do not select those tables during the backup process.

Conclusion

To have a full backup of your WordPress Website all what you need is implementing Step1 AND Step2. If you don´t take backups seriously, you might one day find out the hard way when your entire Website is gone.

Also regular backups, is one important factor in your Website´s overall security strategy as I discussed in my previous tutorial.