Different frontend and backend domains

Last updated on
4 November 2020

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Introduction

Most Drupal-websites use the same domain for both frontend and backend (content editing), but in some use cases is the frontend using separate domain. E.g. when using Drupal 7 fully decoupled or when there is a requirement for a separate edit / backend domain. In these cases will the Siteimprove CMS plugin, when used on the backend domain, not know about the frontend domain and therefore show that a specific page is unknown by Siteimprove. 

This is where the support for different frontend and backend domains comes in useful. The Drupal 7 version of the module support simple configuration of a frontend domain and altering of the generated page URL in code for more advanced use cases.

Frontend domain configuration

Siteimprove frontend domain configuration
Frontend domain configuration

  1. Navigate to the Siteimprove Plugin settings page; /admin/config/system/siteimprove
  2. Find the Frontend domain fieldset on the configuration form.
  3. Input your domain without protocol, path/folders, trailing slash etc. in the Domain field.
  4. Click on Save Configuration button.

Altering the page URL

For more advanced use cases can you alter the page URL in code using hook_siteimprove_frontend_url_alter(). Example:

/**
 * Implements hook_siteimprove_frontend_url_alter().
 *
 * @param string $rewritten_url
 *   The rewritten URL that can be altered.
 * @param string $original_url
 *   The full original URL of the page before being rewritten by the
 *   Siteimprove module to use the configured frontend domain.
 */
function example_siteimprove_frontend_url_alter(&$rewritten_url, $original_url) {
  $rewritten_url = str_replace('adobe.com', 'drupal.org', $rewritten_url);
}

Notice: this hook allow rewriting the full URL of the page and not only the domain!

Help improve this page

Page status: No known problems

You can: