≡ Menu

ServerLess WordPress Hosting

When it comes to a personal blog or a small website, the go-to choice for web developers is usually a Content Management System (CMS) like WordPress or Drupal. When we look at how the web has evolved over the past decade or two, is we all started with a static web hosting and then moved to a CMS which usually runs on a LAMP (Linux, Apache, MySQL, PHP) server(s). When you look at a CMS hosting such as a blog, it usually is somewhat cheap however, it comes with it’s own fair share of problems. The main aspect of the problem, in my opinion, is Security. You have to make sure your application such as WordPress and all the plugins are updated at all times. This is where a hacker would try and exploit a WordPress site or any of its plugins as soon as a vulnerability is spotted.

The solution is to implement a number of security measures on the website and manage it yourself. This option would be very cost effective, however, it does require a fair bit of technical knowledge. The other option is to go with a fully managed WordPress hosting, where the provider will manage the security aspect of your website. Even though having a fully managed hosting doesn’t usually guarantee your safety because there are other factors such as third-party plugins. If you have a secured LAMP server with the updated WordPress installation, it is still not guaranteed to be secured, because a hacker will find a way through to your website via a poorly corded or outdated third-party plugin. When it comes to choosing the plugins, make sure you ask yourself whether you really need it and keep the plugin-count as low as possible.
[click to continue…]

Exim Error: Exit R=virtual_aliases: No Such User Here

T he following Exim mail servers error was encountered while sending out mails. The original error was experienced by Gravity Forms WordPress plugin. However, I was able to test it out by using command line to rule out the plugin.

someone@domain.com R=virtual_aliases: No Such User Here

The debug message I received via Gravity Forms is the following. This confirms the mail has been passed on from WordPress to the mail server.

2016-03-25 11:06:04.042599 - DEBUG --> GFCommon::send_email(): Result from wp_mail(): 1
2016-03-25 11:06:04.042748 - DEBUG --> GFCommon::send_email(): Mail was passed from WordPress to the mail server.
2016-03-25 11:06:04.153172 - DEBUG --> GFFormDisplay::handle_confirmation(): Sending confirmation.

Before I go any further, I would like to give some background information on domain.com, which the following aspects are hosted as below.

[click to continue…]

How to restrict WordPress login to specific IPs

This involves adding the following code to the .htaccess file within the root of the WordPress installation directory and add each IP addresses to a new line and IP subnet in the CIDR format.

The below code is displayed as an image due to WordPress limitation.

Screen Shot 08-04-15 at 10.17 AM

WordPress Search and Replace using phpMyAdmin

The following method I use to search and replace text on WordPress using phpMyAdmin.

In WordPress, If you have changed the default Table Prefix; that needs to reflect wp_posts.

And finally, replace FIND/REPLACE texts with the appropriate ones.

UPDATE wp_posts SET post_content = REPLACE (  
post_content,  
'FIND',  
'REPLACE');

How to stop WordPress Brute-force login attack

Wordpress admin login easily be filtered by IP Address. This method is especially useful as a measure to tackle Brute-force login attack.

This is achieved by placing a .htaccess in the wp-admin directory with the following…

Order Deny,Allow
Allow from IP.IP.IP.IP
Allow from IP.IP.IP.0/24
Deny from all

You can also use the CIDR notation to Allow/Deny a range of IP addresses.

WordPress Find and Replace String

I had to do a find and replace a string on all of the wordpress post. This can only be done via a MySQL query and won’t take more than a minute.

This is how it’s done. In the following example, I will be finding X and replacing it with Y

The string will find X in every single post and replace it with Y. This also works with phrases, URLs etc..

update wp_posts set post_content = replace(post_content, 'X', 'Y')

How to 301 Redirect WordPress Posts To New Domain

301 Redirect is considered as a permanent redirect compared to a 302 redirect which is temporary. Therefore when moving wordpress to a new domain, it is a good idea to redirect all the posts to the new domain.

This way all the search engine records will be kept intact and this means you won’t lose any traffics / hits to the website.

This doesn’t mean redirecting from fnode.com to nish.com, it will also redirect every single URL associated with fnode.com to nish.com.

For instance, if a user is looking for a particular post and goes to fnode.com, they will be redirected to the corresponding post on nish.com

Here is an example of one of the most popular post on the site…

http://www.fnode.com/2007/06/02/make-bisoncam-work-on-windows-vista/

When users clicks on the above link, they will be automatically redirect to

http://www.nish.com/2007/06/02/make-bisoncam-work-on-windows-vista/

This way, the user won’t notice the domain change because it is 99% directed via search engine or linked URL.

This method is also a good way to let GoogleBot to know that the domain has been moved permanently from fnode.com to nish.com

Here is the code below and I used which goes into the .htaccess file. All you got to do is to replace the URL to make it work with your own domain.


# BEGIN WordPress
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.fnode.com
RewriteRule (.*) http://www.nish.com/$1 [R=301,L]
# END WordPress

Moving wordpress blog to new domain

This is how I moved my wordpress blog from fnode.com to nish.com

  • Install wordpress on nish.com
  • Went to fnode.com and copied the wp-content Directory and replaced it with the Directiory on nish.com (So all the theme, plug-in and the uploaded contents are all there…)
  • Went to fnode.com and used phpMyAdmin to drum an .sql file of the database. (You may prefer .gz depending on the file size)
  • Went to nish.com and used phpMyAdmin to drop all the tables on the wordpress database.
  • Imported the backed up database from fnode.com

Ran the following SQL Queries…

UPDATE wp_options SET option_value = replace(option_value, 'http://www.fnode.com', 'http://www.nish.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.fnode.com','http://www.nish.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.fnode.com', 'http://www.nish.com');

That’s it, All set, now you can tweek the blog!

Copyright © Nish Vamadevan 2002-2018. All Rights Reserved. Terms and Policies.