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
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.
public_html) needs to be writable from your WordPress installation.
Considering the following setup:
Staatic would publish your static site\'s assets to
/home/example/domains/www.example.com/public_html/ (the target directory in this case).
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.
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.
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
AllowOverrideoption enabled. Without
.htaccessfile 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.confconfiguration file, make sure to include it within your virtual host. Check the documentation for more information.
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.
robots.txt, a Bing/Google/Yahoo/etc. verification file.
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-uploadsdon\'t need to be crawled and processed.