Closed Briscoooe closed 4 years ago
Hey just wondering if there's any update on this?
Hi @Briscoooe,
Sorry, been out of action a while.
There should be another similar issue to this in this repo of https://github.com/WP2Static/wp2static, where I explain a bit more about why it happens and recommended alternatives (ie, proxying requests to route to a subdir from (sub)domain which you deploy to.
So, in short, it's a limitation/issue with the plugin at the moment, trying to deploy and rewrite links to a subdirectory of target domain and not expected a solid fix anytime soon.
The issue I am having is not limited to subdomains. If I have my wordpress site on www.mywp.com and I want to host the static site on Destination URL www.mystatic.com, the final static version still has absolute references to www.mywp.com.
With this setup, my wordpress site must be online at all times to serve the URLs that were not rewritten as relative.
Hi @Briscoooe, my apologies for not reading correctly.
In that case, please try this updated version of the plugin, which does a much better job of rewriting: https://github.com/WP2Static/static-html-output-plugin/files/4822705/static-html-output-plugin-6.6.21.zip
Note, plugin name is Static HTML Output. Suggest starting by using the Zip deploy method.
I am currently on the latest version in the plugin store, is this version not sufficient?
I have written a plugin to address this. Not sure if it would help you or not.
https://github.com/EricP/static-html-output-post-deploy https://github.com/EricP/static-html-output-post-deploy/archive/rewrite.zip (download plugin)
This is for WP admin deployment only and not CLI as it uses the form data to grab the rewrite rules, and then applies them to the files on disk.
@leonstafford I installed the version in your zip, now I don't even see an option for relative URLs.
Am i missing something? Also the docs are empty.
@leonstafford any update on this?
@Briscoooe - no more relative URLs. I've gone into more detail about why in a few GH issues and possibly on the forum: https://staticword.press
Sorry for delay, I've still been out of action mostly for last month, starting to catch up now hopefully.
For Static HTML Output, minimal docs in readme of this repo. Old docs which should still be of use at https://docs.wp2static.com for now.
Going to be redoing docs for all 3 WP -> Static projects I'm maintaining
ok no problem.
Thank you for the help!
Configurations
Firstly, here are the configurations I am using. These are the ones i have changed, all others are the same.
WP2Static version - Version 6.6.7
Deploy Static Website
Subdirectory on current server
https://example.com/static
/home/example.com/user/public_html/static
Processing
Checked
https://example.com/static/
The problem
The build and deployment is successful but none of the links do not go to the right place. I can view my static site at https://example.com/static/ but all the links redirect to the original site, without the /static/ prefix. For example when trying to link to the /about page, I am brought to https://example.com/about instead of https://example.com/static/about.
The base tag appears like this and i believe its correct
But none of the relative URLs work because they are all prefixed with a forward slash like this
When I manually remove the forward slash like this, it works fine. This example suggests its the correct way to do it.
Is this an error in my configuration or an issue with the plugin?