Roots Discourse

Test .htaccess in local Bedrock Trellis-powered environment?

Could you recommend me how to test .htaccess functionality on my local Berock/Trellis-powered evironment?

To elaborate - my production server runs on Apache. I need to restrict some downloads (mostly PDFs) to logged-in users. It seems, that serving of uploaded files (by URLs such as does not concern Wordpress at all, so I need to intercept it with some sort of server tool. Would it be possible to test my approach on my local environment, which runs on Bedrock/Trellis (that uses, yes, NGINX and not Appache?).

Thanks in advance!

Server management isn’t my forte, but I don’t think there’s any way to directly test an .htaccess configuration in NGINX.

If all you need to do is test the .htaccess rules, then I’d probably spin up a LAMP VM (I usually use Scotch Box for that because it’s super simple and pretty quick), and copy your WP install over to that for testing. If you’re going to need to continue developing on this site, though, you might want to consider switching away from Trellis to another VM that’s closer to your production server. IMO the major benefit to Trellis is that it allows you to easily make dev and prod servers that exactly match, and if you’re not doing that it seems like it’s just going to cause you problems.

Thanks for your suggestions, @alwaysblank! I was hoping there could be some simpler way. If not, then yes, I guess my only option is to create another local environment for testing my .htaccess rules.