Remove directory and all its content in PHP

To recursively delete all the contents in the directory and then the directory itself. This function checks for files and sub directories and delete them first before deleting the main folder.

$directory      = "uploads";
function recursiveRemoveDirectory($directory) {
    foreach(glob("{$directory}/*") as $file) {
        if(is_dir($file)) {
        } else {

404 error in accessing child theme in wordpress multisite

If you are using IIS Server and need to install wordpress multisite. Click here for the installation process.

After installing the multisite when you create a child theme, there might be a problem you are getting 404 error. It means the path you are trying to access on your web browser is not able to redirect to the specified directory. It is the problem for redirection. In this case just update your web.config if you are using the Windows IIS Server or update the .htaccess file if you are using the apache/linux Server.

Code for web.config file:

<?xml version="1.0" encoding="UTF-8"?>
                <rule name="WordPress Rule 1" stopProcessing="true">
                    <match url="^index.php$" ignoreCase="false" />
                    <action type="None" />
                <rule name="WordPress Rule 2" stopProcessing="true">
                    <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
                    <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
                </rule> Continue reading 

Install WordPress with Multiple Domains or Subdomains

To change WordPress from the standard single site install to a WordPress Multisite which allows you to create a network of sites you need to:

  1. Update your wp-config.php file.
  2. Choose the structure of your Multisite in terms of whether you want to use sub-domains or sub-directories.
  3. Add the extra lines your WordPress installation generates into your wp-config.php.
  4. Add the generated mod_rewrite rules to your .htaccess file, replacing other WordPress rules.

You do this as follows:

Updating your wp-config.php file

  1. Locate your wp-config.php file on your hard drive.
  2. Open your wp-config.php file for editing.
  3. Add the following line to your wp-config.php file:
define('WP_ALLOW_MULTISITE', true);

above where it says /* That’s all, stop editing! Happy blogging. */: Continue reading