1

Here is my url to a custom type :

http://host/movie/my-slug

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

http://host/movie/my-slug/?post_type=movie

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 ?

2

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.

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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