wordpress

https-redirects

How to redirect HTTP to HTTPS Using .htaccess

Chrome and Firefox have been showing insecure website warnings on sites that do not have valid SSL certificates. Without valid SSL, the website will show insecurity to the visitors. Therefore, using a valid SSL-encrypted connection for safety is necessary. that is why It becomes very important to redirect your site from HTTP to HTTPS.

[sc name=”readalso”]

What is SSL?

SSL (Secure Sockets Layer) is a standard security protocol for establishing encrypted links between a web server and a browser in online communication.

The usage of SSL technology ensures that all data transmitted between the web server and browser remains encrypted.

An SSL certificate is necessary to create an SSL connection. You would need to give all details about the identity of your website and your company as and when you choose to activate SSL on your web server. Following this, two cryptographic keys are created — a Private Key and a Public Key.

How to redirect HTTP to HTTPS

  1. Redirect All Web Traffic
  2. Redirect Only a Specific Domain
  3. Redirect Only a Specific Folder

How to

To force your web traffic to use HTTPS, there are two ways: to edit the codes in the .htaccess file.

Before we move on redirecting HTTP to HTTPS, here’s how you can edit the .htaccess file. you can skip to the Redirection steps if already know about it.

https valid ssl
Character illustration of people holding world wide web icons

Editing .htaccess File

There are instructions in the .htaccess file that tell the server how to act in certain scenarios which directly affects how your website will functions. Common directives in .htaccess file:

  • Redirects
  • Rewriting URLs

Ways to edit a .htaccess file:

  1. Edit the file on your computer and upload it to the server using FTP.
  2. Use “Edit” mode in FTP program that allows you to edit a file remotely.
  3. Use a text editor and SSH to edit the file.
  4. Use the File Manager in cPanel to edit the file.

Bonus:

Do you know in WordPress you can do this using a plugin, Here is a guide for you on how to install a WordPress plugin?

Editing .htaccess in cPanel File Manager

Note You should take a complete back of your site before any changes.

  1. Login to cPanel
  2. Files > File Manager > Document Root for:
  3. Now select the domain name you want to access
  4. Check “Show Hidden Files (dotfiles)”
  5. Click “Go”
  6. After a new tab or window opens, look for the .htaccess file.
  7. Right click on the .htaccess file and click on “Code Edit” on the menu.
  8. A dialogue box may pop up asking about encoding. Click “Edit” button to continue.
  9. Edit the file
  10. “Save Changes” when done.
  11. Test your website to make sure it is done correctly. In case, there is an error, restore to the previous version and try again.
  12. Once you are done, click “Close” to close the window.

1. Redirect All Web Traffic

If you have existing code in your .htaccess, then add the following code at the top

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

2. Redirect Only a Specific Domain

For redirecting a specific domain to use HTTPS, add the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

The code for our website looks like this

RewriteEngine On
RewriteCond %{HTTP_HOST} ^easywpknowledge\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.easywpknowledge.com/$1 [R,L]

3. Redirect Only a Specific Folder

Redirecting to HTTPS on a specific folder, add the following:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.yourdomain.com/folder/$1 [R,L]

Replace “yourdomain” with your actual domain name(eg: easywpknowledge.com), wherever required. Also, in the case of the folder, replace it with the actual folder name.

ssl activated

How to Use SMTP Server to Send WordPress Emails

The draw backs of WordPress mail() function

WordPress uses mail() function in PHP to send emails. Many hosting providers does not configure have this function properly, or to avoid abuse they have disabled it entirely. In either case, this causes your WordPress emails function to not function as expected .

Third party email service is the alternative solution is to send out your emails from wordpress. You can use services like Mailgun, Google Apps for work, or Sendgrid or sendinblue and many more…

You may have free services for limited number of emails, which is perfect for small blog, website or store. If you want high services you will have to pay for your account, and the cost will depend on how many emails you send. in this tutorial we show you how to fix WordPress not sending email issue completely.

What if told you that there is another option, and likely you are already paying for it? seems good!

2. Using Email Accounts given by Your Hosting provider

Most WordPress hosting providers offer email services free for each domain you host on their hosting servers. This means you can create email accounts with your own domains name like admin@yourblogaddress.com

First of all you will need to create an email account. You can do this easily in your cPanel by following steps. Your hosting service provider visual may differ from following account management system, but the basic is the same on most hosting services.

Log into your site hosting cPanel account, and click on Email Accounts under the mail section.

cPanel Dashboard

This will show you a form where you need to fill out required information to create your email account(s)/.

Since this will be your official email for WordPress site, we advise that you create an email account like admin@yourblogaddress.com.

Make sure to replace yourblogaddress with your own domain name.

cPanel email account creation

After successfully creating your email account, you are now ready to use it in WordPress. But before continuing you do that, you will need the blow information from your hosting service provider.

  1. SMTP Hosting address
  2.  
  3. SMTP Port number for secure login.

You can check the support section on your host’s website, cPanel managing, for this information. If you are unable just comment blow so we help you find it or you should contact the hosting support to request this information.

cPanel SMTP Info

Install the Easy WP SMTP Plugin to your WordPress

You will now need to install and activate the Easy WP SMTP plugin. For more details, see our following step by step guide on how to install WordPress plugin.

Easy WP SMTP Plugin install
Upon activation, you need to visit Settings » Easy WP SMTP to configure the plugin settings.
Easy WP SMTP Plugin settings

Here you should provide the information that you get from your cPanel email account manager as provided above in picture.

Testing Your Easy WP SMTP

Now that you have set up Easy WP SMTP to send emails, let’s test if our plugin  and check if its working fine. On the plugin’s settings page, click on the ‘Test Email ’ tab. As seen blow

Easy WP SMTP Plugin test email
You need to provide your active email address where you would like to receive test email. This could be any Gmail oy Yahoo or any other valid email address that you can access right now. After that click on the “Send Test Email” button to continue process. Easy WP SMTP will now send an email message using the new SMTP settings you entered. You will see a success message when email is sent successfully.
You did it!

How to Add a Retweet Button on Your Blog Post

Twitter has seen exponential growth in the past few years which is the main reason why more and more writers are now sharing their stories on twitter handle. If you have seen one of the coolest Retweet buttons on some of most famous blogs, they can be on your blog also.

In this article, we will show you how to add a Retweet Button in all of your posts/pages, so your audience can Tweet your stories with just one click.

There are two main ways to add retweet button in your site. First is through the WordPress Plugin called Tweetmeme

Upload the plugin into example.com/wp-content/plugins/

Visit plugin page from dashboard and find “tweetmeme”

Activate it, and then visit the plugins settings page.

You can change the RT @tweetmeme which is default to RT @yourusername. In our case it would be RT @yourtwittername.

This plugin also allows you to choose the location of the button placement. bottom left Corner, Top right Corner, and so on.

The second way is to do it manually by placing the following codes in your templates file at the location where you want.

For the Large Button:

<script type="text/javascript">
tweetmeme_source = 'Easywpknowledge';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"> </script>

For the Compact Button:

<script type='text/javascript'>
tweetmeme_style = "compact";
tweetmeme_source = 'Easywpknowledge';
</script>

Now you have a Retweet button on your blog. You are now able to get more exposure. Follow Easywpknowledge on Twitter.