301 Redirects

In addition to creating and distribute a static copy of your site and hosts your WordPress installation, HardyPress is able to instruct the CDN servers about 301/302 redirects so they will set correct response-headers.
It is therefore important to understand how redirects are detected on your WordPress site and propagated to the static version.

Our spider, the software that create the static version, works a bit like a web crawler, starting at the main page of your website and looking for links to other pages to create static copies of. It also includes any images, CSS & JS files, and any other files that it can find a link to.

When our crawler detects a 301/302 redirect, it is also propagated on the static site, and things continue to work flawlessly, but our crawler can not be aware of pages that are not linked anywhere in the HTML sources.

Let’s make an example:

Let’s assume in your menu you have an item like this:

<li>
 <a href="/services"> Services </a>
</li>

When you deploy your site our crawler will detect the href="/services" and will recursively follow the link.

Let’s assume for some reason you change your page permalink to be reachable on /our-services instead and you setup a 301 redirect from /services to /our-services using your favorite redirection plugin or your .htaccess file.

If you do not change your HTML menu, everything will works fine because our crawler:

  • will find a link to /services in the menu
  • will follow it
  • will detect the 301 redirect
  • will follow the 301 redirect crawling the /our-services page

On the other hand, if you change the HTML in this way instead

<li>
 <a href="/our-services"> Services </a>
</li>

our crawler

  • will find a link to /our-services in the menu
  • will follow it, crawling the /our-services page
  • IS NOT going to be aware of the /service URL because it is not linked anywhere in your HTML

If you try to access /services on your static site you will get a “404 Not Found” error, even if you correctly get a 301 on your WordPress site.

To solve this you simply need to “instruct” our crawler about the /services existence adding this path to the deploy settings on HardyPress. Don’t forget to generate a new deploy for your changes to take effect!

Redirect from http to https

Enabling SSL for your site automatically will force every request to be in https. If you try to access http://www.example.com you will be 301 redirected to https://www.example.com so beware of the “insecure content” errors if you link to some non https resource in your HTML.

Redirect from www to non-www domain

You can add an existing domain to your HardyPress website, but since the www and the non-www (naked) domains are a completely different things for both DNS and SEO, you need to elect one of them to primay, and add this one to Hardypress.
If you want to redirect your non-primary domain (eg. www.example.com) to your primary domain (eg. example.com) you can usually do this easily at DNS level (eg. Cloudflare allows you to set page-rules). If you are unable to do that, drop an email to support@hardypress.com and we will try to configure a custom setup for your needs.