$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>redirect automatic page that serves custom posttype content|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

redirect automatic page that serves custom posttype content

matteradmin10PV0评论

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)

Share Improve this question asked Jan 5, 2019 at 13:14 LudoLudo 612 silver badges11 bronze badges 5
  • 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
Add a comment  | 

1 Answer 1

Reset to default 0

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/blogpost (single-mycustomposttypename.php); a collection page of all posts. I named it archive-mycustomposttypename.php.

Post a comment

comment list (0)

  1. No comments so far