/** * company_detail URLでカテゴリ34(印刷会社詳細)以外の投稿へのアクセスを404にする * 画像やリビジョンなど、誤ったURLがインデックスされる問題を防ぐ * Added: 2026-01-22 */ function block_invalid_company_detail_urls() { if (is_admin()) return; $request_uri = $_SERVER['REQUEST_URI']; // /company_detail/ で始まるURLの場合のみ処理 if (strpos($request_uri, '/company_detail/') !== false) { // 数字のIDを抽出 if (preg_match('/\/company_detail\/(\d+)\/?/', $request_uri, $matches)) { $post_id = intval($matches[1]); // そのIDが「印刷会社詳細」カテゴリ(ID:34)に属しているか確認 if (!has_category(34, $post_id)) { // 404を返す global $wp_query; $wp_query->set_404(); status_header(404); nocache_headers(); include(get_404_template()); exit; } } } } add_action('template_redirect', 'block_invalid_company_detail_urls', 1); /** * より早い段階でcompany_detail URLの不正アクセスをブロック * parse_requestはtemplate_redirectより前に実行される * Added: 2026-01-22 */ function block_invalid_company_detail_early($wp) { if (is_admin()) return; $request_uri = $_SERVER['REQUEST_URI']; // /company_detail/数字/ のパターンをチェック if (preg_match('/\/company_detail\/(\d+)\/?/', $request_uri, $matches)) { $post_id = intval($matches[1]); // 投稿が存在し、カテゴリ34に属しているか確認 $post = get_post($post_id); if (!$post || $post->post_type !== 'post' || !has_category(34, $post_id)) { status_header(404); nocache_headers(); include(get_404_template()); exit; } } } add_action('parse_request', 'block_invalid_company_detail_early', 1); /** * 最も早い段階でcompany_detail URLの不正アクセスをブロック * initはWordPressの初期化時に実行される * Added: 2026-01-22 */ function block_invalid_company_detail_init() { if (is_admin()) return; $request_uri = $_SERVER['REQUEST_URI']; // /company_detail/数字/ のパターンをチェック if (preg_match('/\/company_detail\/(\d+)\/?/', $request_uri, $matches)) { $post_id = intval($matches[1]); // 投稿が存在し、post_typeがpostで、カテゴリ34に属しているか確認 global $wpdb; // post_typeを確認 $post_type = $wpdb->get_var($wpdb->prepare( "SELECT post_type FROM {$wpdb->posts} WHERE ID = %d", $post_id )); if ($post_type !== 'post') { status_header(404); nocache_headers(); echo '404 Not Found

404 Not Found

'; exit; } // カテゴリ34に属しているか確認 $in_category = $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->term_relationships} tr INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id = %d AND tt.term_id = 34", $post_id )); if (!$in_category) { status_header(404); nocache_headers(); echo '404 Not Found

404 Not Found

'; exit; } } } add_action('init', 'block_invalid_company_detail_init', 1); /** * company_detail URLでのcanonicalリダイレクトを無効化 * Added: 2026-01-22 */ function disable_canonical_redirect_for_company_detail($redirect_url, $requested_url) { if (strpos($requested_url, '/company_detail/') !== false) { if (preg_match('/\/company_detail\/(\d+)\/?/', $requested_url, $matches)) { $post_id = intval($matches[1]); global $wpdb; $post_type = $wpdb->get_var($wpdb->prepare( "SELECT post_type FROM {$wpdb->posts} WHERE ID = %d", $post_id )); if ($post_type !== 'post') { return false; // リダイレクトを無効化 } } } return $redirect_url; } add_filter('redirect_canonical', 'disable_canonical_redirect_for_company_detail', 1, 2); /** * attachment post typeへのredirect_canonicalを完全に無効化 * Added: 2026-01-22 */ add_filter('redirect_canonical', function($redirect_url, $requested_url) { // デバッグ用ログ error_log("redirect_canonical called: requested=$requested_url, redirect=$redirect_url"); if (strpos($requested_url, '/company_detail/') !== false) { error_log("Blocking redirect for company_detail URL"); return false; } return $redirect_url; }, 0, 2); /** * attachment post typeへのredirect_canonicalを完全に無効化 * Added: 2026-01-22 */ add_filter('redirect_canonical', function($redirect_url, $requested_url) { // デバッグ用ログ error_log("redirect_canonical called: requested=$requested_url, redirect=$redirect_url"); if (strpos($requested_url, '/company_detail/') !== false) { error_log("Blocking redirect for company_detail URL"); return false; } return $redirect_url; }, 0, 2); XML Sitemap

XML Sitemap Index

This XML sitemap is used by search engines which follow the XML sitemap standard. This file contains links to sub-sitemaps, follow them to see the actual sitemap content.

This file was dynamically generated using the WordPress content management system and XML Sitemap Generator for Google by Auctollo.

URL of sub-sitemapLast modified (GMT)
https://natuna.jp/sitemap-misc.html2026-01-21T14:36:04+00:00
https://natuna.jp/dfads_group-sitemap.html2026-01-21T14:36:04+00:00
https://natuna.jp/post_tag-sitemap.html2026-01-21T14:36:04+00:00
https://natuna.jp/category-sitemap.html2026-01-21T14:36:04+00:00
https://natuna.jp/externals-sitemap.html2026-01-21T14:36:04+00:00
https://natuna.jp/item-sitemap.html2026-01-21T14:36:04+00:00
https://natuna.jp/campaign-sitemap.html2026-01-16T09:44:10+00:00
https://natuna.jp/campaign-sitemap2.html2026-01-16T09:44:10+00:00
https://natuna.jp/pickup-sitemap.html2026-01-20T06:34:32+00:00
https://natuna.jp/designer_intro-sitemap.html2025-10-10T11:13:45+00:00
https://natuna.jp/kodawari_parent-sitemap.html2024-11-19T02:27:35+00:00
https://natuna.jp/kodawari_child-sitemap.html2025-04-04T05:58:15+00:00
https://natuna.jp/taiken_report-sitemap.html2018-08-24T03:47:56+00:00
https://natuna.jp/ranking-sitemap.html2025-10-24T09:02:25+00:00
https://natuna.jp/post-sitemap.html2026-01-20T06:31:55+00:00
https://natuna.jp/post-sitemap2.html2026-01-20T06:31:55+00:00
https://natuna.jp/page-sitemap.html2025-10-13T12:01:51+00:00
https://natuna.jp/authors-sitemap.html2026-01-21T14:36:04+00:00