Header and footer fail to load with SSL and custom links

I have an existing site that I am now trying to secure, but I'm running into problems with the header and footer on the pages that are accessed via custom links in the menu. When I try to access a custom link (such as http://mywebsite.com/SomeNonWordPressComponent), the content loads, but the header and footer render as:

Moved Permanently

The document has moved here (https://localhost/common/header.php).

The header and footer on regular WordPress pages render perfectly fine.

What do I have to change so that the header and footer will render correctly for custom pages?


Things I've tried so far:

  • set WP_HOME and WP_SITEURL to begin with https.
  • click the "Save Changes" button on the Permalinks page.
  • manually add to my WordPress root directory's .htaccess this extra rewrite rule:
     RewriteCond     %{HTTPS} off
     RewriteRule     (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Still getting the redirect (as above) for the header and footer.

Also: the path common/header.php actually exists up one level from the wordpress root directory. Tried a symlink in wordpress to /path/to/webroot/common bt that does not seem to work, either.

Topic footer headers templates ssl Wordpress

Category Web


Go to your WordPress dashboard and navigate to Settings >> General, then change the WordPress Address (URL) and the Site Address (URL) from HTTP to HTTPS. Then hit Save Changes button.

If your problem is not fixed yet then go to Settings >> Permalinks and hit Save Changes button again. It'll re-generate your .htaccess file. Sometimes the .htaccess cause some unusual problems. I'm just making sure that its fine.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.