Category Archives: Wordpress

Redirect www to naked domain using CloudFlare – Server Fault

  • I guess I just solved the problem. I added a CNAME for the www subdomain plus a PageRule to forward requests made to it. – rbaprado
  • PageRule won’t work without a CNAME – Artem Feb 23 ’17 at 17:04
  •  This is the redirection page rule that worked for me.
** -->$2

The image below shows the details.

Cloudflare URL Forwarding

Source: Redirect www to naked domain using CloudFlare – Server Fault

How to move a WordPress site from root folder to a sub directory while using nginx

Lately I had to move my WordPress blog from to since I had to host a different site at My WordPress blog was running on nginx and Ubuntu 16.04 LTS.

If you are using nginx to run WordPress, you can perform the following steps to move your WordPress site to its own sub-directory

Update the URL in WordPress

  1. Login to your WordPress blog at
  2. Goto Settings->General and update WordPress Address (URL) and Site Address (URL) from to

As soon as you click “Save Changes”, the URLs will update and the WordPress site will stop working. We will fix this in the next step.

Move WordPress files from the root folder to sub-directory

  1. Login to your root directory through FTP. Here, create a directory called blog.
  2. Move all the WordPress files from their current location to the newly created folder blog/

At this stage, you will find that you can access your WordPress site at the new address. There is still one caveat: custom WordPress permalinks don’t work yet.

Reconfigure nginx to fix permalinks

  1. Connect via SSH and open the file /etc/nginx/sites-enabled/ for editing.
  2. You will find the ‘location block’ – a block of text that appears like this:
    location / {
    try_files $uri $uri/ /index.php?$args;

    Just below this block, add the following lines:
    location /blog/ {
    try_files $uri $uri/ /blog/index.php?$args;
  3. Save and exit.
  4. Restart nginx sudo systemctl reload nginx.

Customize Client Admin dashboard

  1. Assign one user an “Editor” Role.
  2. Add capabilities “manage_options”, “list_users” and “delete users” using User Role Editor.
  3. Uninstall URE after making the changes. (the changes are permanent for this user)
  4. Add following to functions.php

// Remove some menus from Client Admin's Dashboard

function remove_menus(){
  if (current_user_can('manage_options')  && !current_user_can('update_core')) {
  remove_menu_page( 'options-general.php' );        //Settings
  remove_menu_page( 'edit.php?post_type=ia_invites');  //Buddypress Invitations
  remove_menu_page ( 'tools.php' );
add_action( 'admin_menu', 'remove_menus' );