I registered blog
as a custom post type. This content is queried on the page page-actueel-blog
. But mydomain/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)
I registered blog
as a custom post type. This content is queried on the page page-actueel-blog
. But mydomain/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ż Commented Jan 5, 2019 at 13:18
- That is right.. they may visit mydomain/blog/blogpost. But I want mydomain/blog to redirect to mydomain/actueel-blog – Ludo Commented Jan 5, 2019 at 13:26
- It doesn’t make much sense. You’re breaking url structure logic this way... – Krzysiek Dróżdż Commented Jan 5, 2019 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 Commented Jan 5, 2019 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ż Commented Jan 5, 2019 at 13:31
1 Answer
Reset to default 0I 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/blogpost (single-mycustomposttypename.php); a collection page of all posts. I named it archive-mycustomposttypename.php
.