WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is my url to a custom type :


When I go to this link, I'm redirected to


which results in a 404 error.

I use Rewrite Rule Inspector wordpress plugin for listing the matching rewrite rules.

It appears that my url matches three rules : (regex new-url source)

  • movie/([^/]+)(/[0-9]+)?/?$ index.php?post_type=movie&name=$matches[1]&page=$matches[2] movie
  • (.?.+?)(/[0-9]+)?/?$ index.php?pagename=$matches[1]&page=$matches[2] page
  • [^/]+/([^/]+)/?$ index.php?attachment=$matches[1] post

Witch one Wordpress will choose for resolving my url ? Why do I have a 404 error ?

share|improve this question
up vote 2 down vote accepted

I think it matches the first one in the array. So you enter specific rules above more general ones. In your case it should be matching the movie rule if it has a lower array index number than the other ones.

share|improve this answer
Ok, but why do I get a 404 error ? – Stephan Oct 12 '12 at 7:49
You'll have to share your code for us to figure that out. – Abdussamad Oct 12 '12 at 9:23
which part of my code should I send ? – Stephan Oct 12 '12 at 10:10
Share the part that creates the custom post type. If you are pluging into the action generate_rewrite_rules to create your own rewrite rules we need to see that too. Finally if you are using add_permastruct show us that code too. Basically everything to do with URL rewriting. – Abdussamad Oct 13 '12 at 11:13
Also use the download option in rewrite rules inspector to grab your rewrite rules. Upload them to pastebin.com or some such site and post the link here. – Abdussamad Oct 13 '12 at 13:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.