Static WP - Preventing URL from doubling up

Please be patient with me—I’m not a developer! Can I tell Cloudflare to not append my domain to the beginning of my files so that I can export with absolute URLs and not have the address “double up” at the beginning?

I’m using localwp.com, rankmath.com, and simplystatic.com with Cloudflare Pages to run my site, taylorclogston.com.

I develop the site locally, then use Simply Static to generate a .zip which I upload to Cloudflare Pages on my custom domain.

In Local, Wordpress uses a temporary URL to develop the site (let’s call this “temp.com”). In the Simply Static plugin, I have three options to replace this URL: absolute URLs, a relative path, or offline usage.

I started by using a relative path, which replaced all instances of “temp.com” with “/”. This worked well for interacting with my site. When I accessed my live site, “temp.com/about me” would become “taylorclogston.com/about me”.

However, this broke index.html and my sitemaps, creating what Google Search Console tells me are critical issues preventing my indexing. In index.html, the “url” field would populate with only “/” this instead of with my actual URL:

<script type="application/ld+json" class="rank-math-schema">{"@context":"`https://schema.org`","@graph":[{"@type":"Person","@id":"`www.taylorclogston.com`/#person","name":"Taylor Clogston","image":{"@type":"ImageObject","@id":"`www.taylorclogston.com/#logo`","url":"`www.taylorclogston.com/wp-content/uploads/2022/05/TaylorIcon-1.jpg`","`contentUrl":"www.taylorclogston.com/wp-content/uploads/2022/05/TaylorIcon-1.jpg`","caption":"Taylor Clogston | Indie Writer","inLanguage":"en-US","width":"150","height":"150"}},{"@type":"WebSite","@id":"`www.taylorclogston.com/#website`",**"url":"`www.taylorclogston.com`"**,"name":"Taylor Clogston | Indie Writer","publisher": ... ]}</script>

And the urls in my sitemaps would become “/page-sitemap.xml” instead of “www.taylorclogston.com/page-sitemap.xml”.

If I instead use absolute URLs to replace “temp.com” with either “taylorclogston.com” or “www.taylorclogston.com”, both the above issues are resolved. However, it breaks my site when I upload to Cloudflare. My live URLs become “https://taylorclogston.com/www.taylorclogston/about-me” and my theme completely breaks.

The only solution I’ve found is to export with relative URLs, then manually add the appropriate information to index.html and the sitemap files after I export. Can I tell Cloudflare to not append my domain to the beginning of my files so that I can export with absolute URLs and not have the address “double up” at the beginning?

1 Like

For others having the same struggle as me, I’m temporarily working around the issue this way:

  1. Exporting the .zip from Static WP with the default relative path settings
  2. Using this script, which processes text in index.html and the .xml sitemap files to add the URLs where they’re supposed to go, then packs it back into a new .zip: https://pastebin.com/65f9y2xr
  3. Uploading the .zip to Cloudflare Pages