Why My WordPress Website Includes Both http://https:// on Canonical Url

If your WordPress website’s canonical URL includes both http:// and https://, it indicates a misconfiguration in the website’s settings or a plugin/theme conflict. This issue can negatively affect SEO and user experience. Here’s how to diagnose and fix it:


Why Does This Happen?

  1. Incorrect Site URL Settings:
    • The WordPress Address (URL) or Site Address (URL) fields in your WordPress settings might be misconfigured.
    • Example: If you accidentally set it as http://https://example.com, the canonical URL will reflect that.
  2. Mixed Content or HTTPS/HTTP Redirection Issue:
    • Conflicts between http:// and https:// caused by plugins (e.g., caching, SEO, or SSL plugins).
    • An improperly configured SSL or redirection setup can lead to this issue.
  3. Theme or Plugin Canonical Tag Misconfiguration:
    • The theme or an SEO plugin (like Yoast SEO or Rank Math) might be generating the canonical tag incorrectly.
  4. Database Corruption:
    • If the URL values in the database (wp_options table) are corrupted or incorrectly set, this can cause the problem.
  5. Hardcoded URLs:
    • A hardcoded canonical URL in the theme or plugin files might be causing the duplication.

Steps to Fix the Issue

1. Check and Correct WordPress URL Settings

  1. Go to SettingsGeneral in the WordPress dashboard.
  2. Ensure both fields are correct:
    • WordPress Address (URL): https://example.com
    • Site Address (URL): https://example.com
  3. Remove any extra http:// or https:// prefixes.Tip: Always use https:// if your site is secured with SSL.

2. Clear Cache

If caching is enabled:

  1. Clear your website cache using caching plugins like WP Rocket, W3 Total Cache, or LiteSpeed Cache.
  2. Clear your browser cache as well.

3. Check SEO Plugin Settings

If you’re using an SEO plugin (e.g., Yoast SEO, Rank Math, or All in One SEO Pack):

  1. Navigate to the SEO plugin settings.
  2. Look for the canonical URL configuration:
    • Make sure it’s set to use the correct URL (https://example.com).
    • Remove any manually entered http://https:// values.
  3. Save changes and recheck the canonical URL.

4. Check for SSL Plugin Configuration

If you’re using an SSL plugin like Really Simple SSL:

  1. Check its settings and ensure there are no conflicting redirect rules or mixed content warnings.
  2. Re-run the SSL setup wizard to correct any issues.

5. Test for Plugin Conflicts

  1. Deactivate all plugins temporarily.
  2. Check the canonical URL to see if the issue is resolved.
  3. Reactivate plugins one by one to identify the plugin causing the issue.

6. Check and Update Theme Files

  • If the issue persists, your theme might have hardcoded canonical URLs:
    1. Go to AppearanceTheme Editor.
    2. Check header.php or similar files for hardcoded canonical tags like: <link rel="canonical" href="http://https://example.com">1
    3. Replace it with:phpCopy code<link rel="canonical" href="<?php echo esc_url(home_url('/')); ?>">
    4. Save the changes.

7. Correct the Database Entries

If the issue is in the database:

  1. Use phpMyAdmin or a database management plugin (like WP-Optimize) to inspect the wp_options table.
  2. Look for siteurl and home options.
  3. Ensure their values are correct (https://example.com) and free of http://https://.SQL Query to check:sqlCopy codeSELECT option_name, option_value FROM wp_options WHERE option_name IN ('siteurl', 'home'); SQL Query to update:sqlCopy codeUPDATE wp_options SET option_value = 'https://example.com' WHERE option_name = 'siteurl'; UPDATE wp_options SET option_value = 'https://example.com' WHERE option_name = 'home';

8. Verify Redirection Rules

  1. Check your .htaccess file (for Apache servers) or Nginx configuration for conflicting rules:
    • Example .htaccess for HTTPS:apacheCopy code<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule>
    • Ensure there are no http://https:// references in the rules.
  2. Test your site after updating .htaccess or restarting the web server for Nginx.

9. Check for Mixed Content Errors

Use browser developer tools to identify if there are mixed content issues or resources (CSS/JS/images) still being loaded over http://.

Fix these by:

  1. Using relative URLs or ensuring all resources use https://.
  2. Updating URLs in the database with a search-and-replace plugin (e.g., Better Search Replace).

Final Step: Test the Fix

  1. Use tools like Google Search Console or Screaming Frog SEO Spider to confirm the canonical tag is correct.
  2. Re-scan your site to ensure no http://https:// URLs remain.
  1. ↩︎

Table of Contents

SHARE

Request a Quote

Maksut M.

Hi, please provide your request details below and I’ll get back to you.