What are methods of doing URL rewrites? I am using trellis, bedrock and sage.
I have having trouble trying to rewrite the url from:
/services/app
to
/services?page=app
/services/app/1
to
/services?page=app&pn=1
I tried to put rewrite directives inside vagrant machine first: /etc/nginx/wordpress.conf
Before I actually add it to the provisioning template file: trellis\roles\wordpress-setup\templates\wordpress-site.conf.j2
I am new to nginx and having trouble writing the correct rewrite rule.
Any help is appreciated!
I understand that this is filed under trellis, and I apologize if this is totally off base for your specific use case.
Curious if you’ve considered using some of the WP core rewrite functions like add_permastruct and add_rewrite_rule instead of making edits to your nginx confs? e.g
To make WordPress work with Nginx you have to configure the backend php-cgi.
If you are already working with WordPress on your server it’s probably worth figuring out why the their rewrite API isn’t functioning. Here is a post that breaks down the rules you’ll need to add to your config block.
If you don’t already I’d recommend getting WP Debug Bar plugin. It supports multiple add-on plugins one of which includes Debug Bar Rewrite Rules.
It could be that the desired permastruct that you’ve added is being ignored for a higher priority match. The plugin above should assist in figuring this out.