I'm declaring a custom post type 'games' with a rewrite rule:

'rewrite' => array('slug' => 'Games','with_front' => false),

So the resulting url for the games archive is <mysite>.com/Games - This works fine.

With a Game entry titled "Example", visiting <mysite>.com/games/Example it automatically redirects to <mysite>.com/Games/Example no problem. This is what I want.

However when visiting the archive of the Games type, it will not redirect if I change the capitalization:

  • With the slug set to Games visiting <mysite>.com/Games works but visiting <mysite>.com/games will redirect to a blog post or page with 'games' in its url.

  • With the slug set to games visiting <mysite>.com/games works but visiting <mysite>.com/Games will redirect to a blog post or page with 'games' in its url.


  • Yes, I flush my permalink settings after changing the rewrite rules. Since the url works for the non-archive pages this is not the issue.
  • I use the custom Month and name permalink setting.
  • I do have archive-games.php defined and working in my theme directory.

Is there a way of ensuring that any case variation of 'games' links to the archive, and not some random blog post?

In other words, is it possible to tell wordpress to ignore the capitalization and always redirect to <mysite>.com/Games even if the user enters <mysite>.com/gAMeS?

I just want it to be convenient for users that happen to type the url in manually and forget to capitalize it.

I could change the slug to lower case 'games' by default, but then

  1. It doesn't look as nice
  2. Again, if a user types "Games" with caps, They are linked to a seemingly random page.
  • Did you flush rewrite rules after adding this CPT? – Krzysiek Dróżdż Jun 19 '13 at 9:49
  • Yes, after changing the slug I always flush the rewrite rules. The point is that the rules only work for one case or the other. I can't have both <mysite>.com/Games and <mysite>.com/games working simultaneously, which is what I want. Whichever one I choose, the other url will then link to the first blog post it finds that contains "games". – Johannes Jun 19 '13 at 9:51
  • I checked source code of WP and it looks like WP is case-sensitive in this scope. You can of course add custom rewrites (rewrite Games to games) but it isn't very neat solution :( – Krzysiek Dróżdż Jun 19 '13 at 13:22
  • Hmm, Could you elaborate? Apart from the rewrite rule in the post type declaration I don't know much about rewriting with Wordpress. Would this be in .htaccess? – Johannes Jun 19 '13 at 23:55
  • Most of the WP rewrite rules are stored in database. You can add this Games->games rule in .htaccess though (it will be fastest, cleanest and easiest solution). – Krzysiek Dróżdż Jun 20 '13 at 19:05

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.