There may be times when you want to serve a "Coming soon" page or some other small amount of content from inside your Drupal docroot. Situations can include running a separate lightweight landing page, or a flat HTML/CSS/JavaScript brochureware website.
You have a few options to serve a static HTML microsite from your Drupal docroot, including either as part of the code repository where you manage them using a version control system (such as Git) or in the files directory where you manage them using sFTP
or rsync
. In general, you should have only a small set of pages that have minimal impact.
.htaccess
files are in place, PHP files will not be executable in subdirectories, with the exception of the docroot/static
directory..htaccess
file inside the directory with your microsite, for example, the static folder that contains the following code:
RewriteEngine On
RewriteRule ^$ index.html [L]
To serve a static HTML website in a subdirectory of a domain (such as example.com/static
), you can commit or push an additional directory containing your HTML, CSS, JavaScript, and image files into your code repository.
Alternatively, you can manage your files using a tool, such as sFTP
or rsync
, to copy the static files into your sites/*/files
directory and redirect requests for a simple path to reference those files instead. This allows you to keep your repository free of changes to non-Drupal files and may make it easier for non-developers to update files, such as images.
In your docroot .htaccess
file, you can use the following code pattern, which you will need to deploy using your Drupal Git repository, in your rewrite rules section (generally between the and tags):
# any paths beginning with the path /static/ (not case sensitive)...
RewriteCond %{REQUEST_URI} ^/static/ [NC]
# Pass-through the matching file from beneath /sites/default/files/SOME-FOLDER and stop processing
RewriteRule ^static/(.*)$ /sites/default/files/folder-with-static-content/$1 [PT,L]
Make sure you place your custom changes directly before the following code snippet in your .htaccess
file; otherwise, the changes will come too late in the file:
# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
If you need to have pages on domain-b.com
until a new Drupal website or multisite is ready, while continuing to operate your Drupal website on domain-a.com
, you can achieve this by uploading the static website files, and then adding the following code to your docroot/.htaccess
file:
# Only serve the static site for a particular host.
RewriteCond %{HTTP_HOST} ^domain-b\.com$
# Don't loop anything targeting the actual mask directory, to allow
# for linked scripts, stylesheets etc in the static HTML
RewriteCond %{REQUEST_URI} !^/static/
#Any requests that made it this far are served from the /static/ directory
RewriteRule ^(.*)$ /static/$1 [PT]
You can combine these two methods to direct a domain to a static HTML website contained in the file system instead of in the code repository. This is particularly useful either if you have a team that needs to be able to update HTML files and is only familiar with sFTP
, or if the static website includes large files.
RewriteCond %{HTTP_HOST} ^domain-b\.com$
# Don't loop anything targeting the actual mask directory, to allow
# for linked scripts, stylesheets etc in the static HTML
RewriteCond %{REQUEST_URI} !^/sites/default/files/static/
# pass-through the matching file from beneath /sites/default/files/ and stop processing
RewriteRule ^(.*)$ /sites/default/files/static/$1 [PT,L]
docroot/.htaccess
file is added before any rewrites for the static microsite.There are some options available display a single page to your visitors while you site is under construction for a single domain:
index.html
and assorted files in the docroot. An example of this would be the code deployed from the tag/WELCOME
tag inside your Acquia repository./admin/config/system/site-information
and set the Default front page to that node.index.html
in the docroot pointing to the index.html
file within the sites
directory. You'll probably need to use full URLs in the CSS and JS links to account for the symlink.If this content did not answer your questions, try searching or contacting our support team for further assistance.
Wed Oct 22 2025 08:59:29 GMT+0000 (Coordinated Universal Time)