I am trying to add a mode rewrite rule to wordpress that seems to fail

I am trying to redirect everything from /app/…. to a certain page – will use that later for angular js.

This is what I came up with :

Read More

add_rewrite_rule('/app/.*', 'index.php?page_id=11', 'top');

However this doesn’t work…

In settings->permalink when I set it to: domain/sample-post/ – it sami-working domain.com/app/{number} will work and redirect to app – nothing else though. like : domain.com/app{anything else} wont work.

When I try different permalink setting I get different results.

Related posts

1 comment

  1. what you probably want is:

    add_rewrite_rule('/app.*', 'index.php?page_id=11', 'top');
    

    But you need to tighten up the url structure as much as possible, for example the above will match /appetizer /applease etc. since they are all leading to the same page your first attempt was probably correct, /app/ and then add whatever you want after the /

Comments are closed.