Is there a way to handle base directories for taxonomies that result in a 404. For example my URLs are:
http://skipology.com/category/…
http://skipology.com/app/…
but the taxonomies / base directories above result in 404. Can they be redirected to a taxonomy index page (which I may need to create) for example without impacting the child directory (post) or is there a better option. If so how? I suspect the answer lies in redirects but I’m not confident.
You can manually create pages named
category
andapp
in admin under thePages
menu, and use a custom page template for each to list out taxonomy terms or whatever you need.EDIT – 301 redirect a request that matches the
pagename
rewrite to another page:The answer by Milo above seems to potentially be a bit off the mark, because it doesn’t result in http://skipology.com/category/ being an actual page, but instead it just redirects to another page. I don’t know for sure so I’m just adding mine here as an alternative.
If you are ok with a little bit of manual setup for this, this would be the simplest way to do this.
The manual part of this is that you will have to create a separate page for each taxonomy. Each page just needs to use the same template, as long as you make the template correctly. You should be able to just detect the taxonomy dynamically and just use the same template on each one. The upside of this is that you don’t need to mess with any rewrite rules or manipulate the template hierarchy. You also make /category/ into an actual page rather than just redirecting to a different URL.
Alternatively, if you want to make this completely automatic as if it were part of the native Template Hierarchy, you will need to add a rewrite rule for each taxonomy to catch those URI’s, then filter the template hierarchy to direct WordPress to the correct template. Take a look at this old answer of mine explaining how to filter the template hierarchy in different ways.
It seems to me that if you go the route the rewrite rules, you’ll need to also add a custom query var. If this is the way you want to go, please let me know in a comment and I will update the answer with more details. I think the first method should suit you fine though.
In the end I’ve found and tested some code that works in .htaccess…
Just need to create something to redirect the other taxonomies to now.