I registered blog as a custom post type. This content is queried on the page page-actueel-blog. But mydomain.com/blog also serves content (by default titles are queried).

I don't want visitors to see this page /blog since this is not designed / styled. Can I let WordPress redirect /blog to page-actueel-blog or should I do this in the .htaccess file?

Should I do this with htaccess, what is the proper redirect (since /blog and page-actueel-blog might both match blog)

  • But this /blog/ will be still visible in single post page (when you go to single blog post, it will have /blog/ in url...) – Krzysiek Dróżdż Jan 5 '19 at 13:18
  • That is right.. they may visit mydomain.com/blog/blogpost. But I want mydomain.com/blog to redirect to mydomain.com/actueel-blog – Ludo Jan 5 '19 at 13:26
  • It doesn’t make much sense. You’re breaking url structure logic this way... – Krzysiek Dróżdż Jan 5 '19 at 13:27
  • I know it doesn't make much sense. This is not the point. I am looking for a way to redirect. – Ludo Jan 5 '19 at 13:29
  • If you want to do it with htaccess, then it has nothing to do with WP and is off-topic here. If you want to solve it correctly, you’ll have to explain what exactly are you trying to achieve. – Krzysiek Dróżdż Jan 5 '19 at 13:31

I solved my own question without breaking the url structure logic, as Krzysiek Dróżdż (thanks!) suggested.

I changed the page named /page-actueel-blog to the custom-post-type 'archive' template. Pretty obvious, but I thought archive was something else entirely.

For whoever may have the same doubts: the archive template is the level up from domain.com/blogpost (single-mycustomposttypename.php); a collection page of all posts. I named it archive-mycustomposttypename.php.

| improve this answer | |

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.