Add Custom Rewrite Rules
If you have complex rewriting requirements, follow these instructions to create NGINX rewrite rules. These redirects are also faster than plugin-based redirects.
Rewrite rules can change part or the whole URL in a request. There are several different types of redirects, but the two most common ones are temporary (302) and permanent (301).
Define rewrite rules
The rewrite rule consists of the following syntax:
rewrite regex URL [flag];
You've added multilingual capabilities to your store and would like to redirect the old default checkout to the
/en/ on the new one:
rewrite ^/checkout/? /en/checkout/ permanent;
/? at the end is there to redirect in the case of a slash or no slash. To use the 302 redirect change
Create a file for rewrites in wp-content
In order to add custom rewrites on WooCart:
- Create or upload a file to the wp-content directory named .nginx-rewrites (file needs to start with a dot)
- Go to the WP-CLI tab and click on Restart Workers in the toolbar.