elementor / wp2static

WordPress static site generator for security, performance and cost benefits
https://wp2static.com
The Unlicense
1.43k stars 270 forks source link

add option to copy .htaccess or other files verbatim #133

Closed leonstafford closed 5 years ago

leonstafford commented 6 years ago

Use case:

User is transferring to a web server supporting htaccess and needs to keep the htaccess there for 301 redirects or such (this may pave the way for including our own .htaccess/entries for the wp-content to contents, etc rewriting

Other uses may include favicons (should be a default kind of thing, though).

themorgan commented 6 years ago

Other use cases include:

Other Notes / Suggestions:

themorgan commented 6 years ago

I realized in the shower this morning that: while I suggested removing the .htaccess code for the caching plugins -- on reflection, it may be more complex than that. Lots of caching plugins add .htaccess lines that do something valuable, like the gzipping, and more broadly, with the flat files, some parts of the caching are made irrelevant but some parts aren't. This requires more thought. Possible solutions include: [a] options to turn it on/off that the user has, [b] maybe support a very limited number of caching plugins [including wp-rocket of course haha] and have a deeper integration with them, [c] give users an interface to adjust the .htaccess rules via your plugin on the static site.

Yeah I know I'm obsessed with your plugin ;)

leonstafford commented 6 years ago

Thanks @themorgan for further fleshing this out.

Perhaps the easiest way for the first cut of this, is to present the user with a copy of the original WP site's .htaccess, with some rules added for 301's of the wp-content to contents, etc as the plugin has set or they have overridden.

Any more advanced usage beyond that and the user is probably proficient enough to setup some more scripts. I should have SSH/SCP deploys working soon, where the user will have the ability to add some pre/post commands to the deploy, such as to unzip an archive on the remote or such.

themorgan commented 6 years ago

Love it! Agreed that anyone who is editing it at the level I articulate above will know what they're doing, or at least think they know what they're doing. And this is much simpler than the complex solution I was imagining above. Some further thoughts on that:

1 - the .htpasswd should always go hand-in-hand with that 2 - not just for the root directory (I often edit the .ht-files in /wp-admin for example)

Thank you!

leonstafford commented 5 years ago

@themorgan - I'll migrate this over to an Idea topic on forum.wp2static.com soon and close the issue.

Hopefully, you've had a chance to play around with the new WP-CLI integration, else will with the release. This should give the behaviour of what I was mentioning re the SCP/SSH deploys, which I don't think I will do via the UI anymore, or at least not for sometime, as the WP-CLI runner now affords the flexibility DIY those workflows.

leonstafford commented 5 years ago

closing this, now that we have Additional URLs and hook support to modify the crawl list https://github.com/leonstafford/wp2static#modify-the-initial-list-of-urls-to-crawl