Drupal - How to force the canonical URL to use http?

Drupal 7

You can implement hook_html_head_alter() to change head tags; the following is untested but should do the trick:

function MYMODULE_html_head_alter(&$head_elements) {
  foreach ($head_elements as $key => &$tag) {
    if (strpos($key, 'drupal_add_html_head_link:canonical:') === 0) {
      if (strpos('https://', $tag['#attributes']['href']) === 0) {
        $tag['#attributes']['href'] = str_replace('https://', 'http://', $tag['#attributes']['href']);

With the metatag module you can use the [current-page:url:relative] token instead of the [current-page:url:absolute] token.

so your canonical tag would become something like: http://www.mywebsite[current-page:url:relative]



Meta Tags