Documentation / Administrator Guide / Deployment / Local Directory

Local Directory

Introduction

The Local Directory deployment method allows you to deploy your static site to a directory on the same server hosting your WordPress installation. The chosen directory is usually configured as the webserver’s document root or “public_html” for the static site.

This deployment method supports the following features:

  • Deployment to a directory on the same server;
  • Support for HTTP redirects;
  • Support for custom HTTP headers;
  • Support for custom error page;
  • Exclusion of specific pre-existing files in the target directory;
  • Symlink/copy of the wp-uploads directory.

Preparation

In order to use this deployment method, both your dynamic WordPress site as well as your static site need to be hosted on the same server. The static site\'s document root (e.g. httpdocs or public_html) needs to be writable from your WordPress installation.

Considering the following setup:

Domain Document Root
wordpress.example.com /home/user/domains/wordpress.example.com/public_html/
www.example.com /home/user/domains/www.example.com/public_html/

Staatic would publish your static site\'s assets to /home/example/domains/www.example.com/public_html/ (the target directory in this case).

Note: HTTP redirects, custom HTTP headers and a custom error page are only supported on Apache or Nginx.

Configuration

In order to configure the Local Directory deployment method, head over to the WordPress Admin and click Staatic > Settings > Deployment. Choose Local Directory as the deployment method and make sure the following fields are entered correctly.

Target Directory

The path to the directory on the filesystem where the static version of your site is deployed.

Note: by default the Target Directory is set to a sub directory of “wp-uploads“. This should be adjusted depending on your setup. See Setup for more information.

Configuration Files

Depending on your hosting environment you can choose to generate an .htaccess configuration file or nginx_rules.conf file that enables HTTP redirects, HTTP status overrides and other server specific options.

Generate Apache Configuration

Enable this option if you\'re on an Apache webserver. When enabled, an .htaccess file will be generated and placed inside the configured target directory.

Note: make sure that your webserver configuration has the AllowOverride option enabled. Without AllowOverride the .htaccess file will not be applied. Check the documentation for more information.

Generate Nginx Configuration

Enable this option if you\'re on a Nginx webserver which imports this configuration file. When enabled, a nginx_rules.conf file will be generated and placed inside the configured target directory.

Note: in order to import the nginx_rules.conf configuration file, make sure to include it within your virtual host. Check the documentation for more information.

Keep Files/Directories

Optionally add file or directory paths (absolute or relative to the target directory) that need to be left intact (one path per line).

Note: files existing in the target directory that are not part of the build and not in this list will be deleted upon deployment.

Examples: favicon.ico, robots.txt, a Bing/Google/Yahoo/etc. verification file.

Symlink/Copy Uploads

Enabling this option makes sure that every file within wp-uploads is available on the static site

Note: on Linux environments this also greatly improves the publication speed since all static assets within wp-uploads don\'t need to be crawled and processed.