Kindly log in to use this feature. We’ll take you to the login page automatically.
LoginGeneral Tech Bugs & Fixes 3 years ago
User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Kindly log in to use this feature. We’ll take you to the login page automatically.
LoginReady to take your education and career to the next level? Register today and join our growing community of learners and professionals.
Your experience on this site will be improved by allowing cookies. Read Cookie Policy
Your experience on this site will be improved by allowing cookies. Read Cookie Policy
manpreet
Best Answer
3 years ago
I've created a wordpress website which dynamically displays one of around 400 thousand products by passing 2 query vars to a WP page which has my custom php template. I'm using WPML to translate my pages and I've enabled the option to keep url vars _brand and _sku. All works fine with this setup (pages displays & status 200 ok header). Language switcher also keeps my query vars.
URL looks like: domain.com/en/products/?_brand=JCB&_sku=01%2F117903
however since i want the url to display like domain.com/en/products/a-brand/a-sku I've added the following rewrite rules to my child's functions.php
I can now surf to the desired URL and I get the same page with the correct product, however the header now gives a 404 as the status.
WPML's language switcher also discards my query vars and just redirects /products/a-brand/a-sku to, for example, /producten (the translation of /products).
but most importantly, the 404 header status is not allowing me to index my pages which i have dumped in a sitemap (around 2M url's) since google thinks the url's are 404's and doesn't index those. This is in contrast is a huge problem.
I've boiled it down to the following problem:
setting header in template doesn't work. Is my regex wrong? any help is appreciated!