I'm trying to do some url rewriting. I've picked this example right off the wordpress wiki here:


The wiki page says:

This example would match a requested URL like this: example.com/nutrition/milkshakes/strawberry/ ...and interpret it to actually mean...

(I've simplified it to redirect to index.php?foo=bar ). However, I'm still getting a 404 error when I try to visit http://localhost/myblog/nutrition/milkshakes/strawberry/. What am I doing wrong?

| improve this question | | | | |
  • what is your actual, not simplified rewrite rule? you have to load a WordPress object- a page, a post, an archive, etc.. You can't just set arbitrary non-existent query vars. – Milo Nov 15 '13 at 2:23
  • @Milo My line for setting the url is exactly as i gave, index.php?foo=bar – Click Upvote Nov 15 '13 at 2:48
  • did you add the rule on the init action? have you flushed rewrite rules by visiting the permalinks settings page? – Milo Nov 15 '13 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.