{"id":20171,"date":"2022-06-18T05:39:07","date_gmt":"2022-06-17T20:39:07","guid":{"rendered":"https:\/\/motoki-design.co.jp\/wordpress\/?p=20171"},"modified":"2024-03-05T05:47:45","modified_gmt":"2024-03-04T20:47:45","slug":"wordpress-disable-redirect-canonical","status":"publish","type":"post","link":"https:\/\/motoki-design.co.jp\/wordpress\/wordpress-disable-redirect-canonical\/","title":{"rendered":"WordPress\u2502\u7279\u5b9a\u306e\u30da\u30fc\u30b8\u3060\u3051\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u30eb\u30fc\u30d7\u304c\u767a\u751f\u3059\u308b\u6642\u306e\u5bfe\u5fdc\u65b9\u6cd5"},"content":{"rendered":"\n<p>\u610f\u56f3\u3057\u306a\u3044\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u304c\u767a\u751f\u3059\u308b\u4e3b\u306a\u539f\u56e0\u306f<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>redirection\u306a\u3069\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u539f\u56e0<\/li>\n\n\n\n<li>.htaccess\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u304c\u8a18\u8f09\u3055\u308c\u305f\u307e\u307e<\/li>\n\n\n\n<li>\u4e0a\u8a18\u3092\u5bfe\u5fdc\u3057\u305f\u304c\u3001\u30d6\u30e9\u30a6\u30b6\u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u52b9\u3044\u3066\u3044\u308b<\/li>\n<\/ul>\n\n\n\n<p>\u7b49\u304c\u60f3\u5b9a\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u308c\u3068\u306f\u5225\u306bWordPress\u306e\u6a19\u6e96\u6a5f\u80fd\u306b\u306f\u5b58\u5728\u3057\u306a\u3044URL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u5834\u5408\u306b<strong>\u4f3c\u305f\u3088\u3046\u306aURL\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b\u6a5f\u80fd<\/strong>\u304c\u5099\u308f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u81ea\u52d5\u88dc\u5b8c\uff08\u6b63\u898f\u5316\u30fb\u30ab\u30ce\u30cb\u30ab\u30eb\uff09\u306b\u3088\u308b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u6a5f\u80fd\u306e\u5f71\u97ff\u3067\u3001<strong>\u7121\u9650\u30ea\u30c0\u30a4\u30ec\u30af\u30c8<\/strong>\u304c\u767a\u751f\u3059\u308b\u73fe\u8c61\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u306e\u3067\u3001\u3053\u306e\u89e3\u6c7a\u65b9\u6cd5\u3092\u8a18\u8f09\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">URL\u306e\u81ea\u52d5\u88dc\u5b8c\uff08\u6b63\u898f\u5316\u30fb\u30ab\u30ce\u30cb\u30ab\u30eb\uff09\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3092\u7121\u52b9\u306b\u3059\u308b\u65b9\u6cd5<\/h2>\n\n\n\n<p>\u5358\u7d14\u306bfunctions.php\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5165\u529b\u3059\u308c\u3070\u3001\u3059\u3079\u3066\u306e\u81ea\u52d5\u88dc\u5b8c\u306b\u3088\u308b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u306f\u505c\u6b62\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><code class=\"dir_name\">WordPress\u306e\u7ba1\u7406\u753b\u9762 \uff1e \u5916\u89b3 \uff1e \u30c6\u30fc\u30de\u30d5\u30a1\u30a4\u30eb\u30a8\u30c7\u30a3\u30bf\u30fc \uff1e functions.php<\/code><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-file=\"functions.php\" data-lang=\"PHP\"><code>remove_action(&#39;template_redirect&#39;, &#39;redirect_canonical&#39;);<\/code><\/pre><\/div>\n\n\n\n<p>\u305f\u3060\u3057\u4fbf\u5229\u306a\u6a5f\u80fd\u3067\u306f\u3042\u308b\u306e\u3067\u3001\u8a72\u5f53\u3059\u308b\u8a18\u4e8b\u3060\u3051\u505c\u6b62\u3057\u305f\u3044\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u3082\u5bfe\u5fdc\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u7279\u5b9a\u306e\u6587\u5b57\u5217\uff08\u4f8b\uff1a<strong>top<\/strong>\uff09\u3092\u542b\u3080URL\u3060\u3051\u3001\u505c\u6b62\u3057\u305f\u3044\u5834\u5408\u306f\u3053\u3061\u3089\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-php\" data-file=\"functions.php\" data-lang=\"PHP\"><code>function motoki_disable_redirect_canonical( $redirect_url, $requested_url ) {\n    if ( strpos( $requested_url, &#39;top&#39; ) !== false ) {\n        return false;\n    }\n    return $redirect_url;\n}\nadd_filter( &#39;redirect_canonical&#39;, &#39;motoki_disable_redirect_canonical&#39; );<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>\u81ea\u52d5\u88dc\u5b8c\u306b\u3088\u308b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u306f\u3001\u9593\u9055\u3063\u305fURL\u3092\u5165\u529b\u3057\u3066\u3082\u4f3c\u305f\u3088\u3046\u306aURL\u3092\u63a8\u6e2c\u3001\u8868\u793a\u3057\u3066\u304f\u308c\u308b\u4fbf\u5229\u306aWordPress\u306e\u6a5f\u80fd\u3067\u3059\u304c\u3001\u7279\u5b9a\u306e\u6761\u4ef6\u304c\u4e00\u81f4\u3057\u3066\u3057\u307e\u3046\u3068\u7121\u9650\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u304c\u8d77\u304d\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u306e\u5834\u5408\u306f\u3053\u306e\u8a18\u4e8b\u306e\u30b3\u30fc\u30c9\u3092\u53c2\u8003\u306b\u3057\u3066\u505c\u6b62\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u610f\u56f3\u3057\u306a\u3044\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u304c\u767a\u751f\u3059\u308b\u4e3b\u306a\u539f\u56e0\u306f \u7b49\u304c\u60f3\u5b9a\u3055\u308c\u307e\u3059\u3002 \u305d\u308c\u3068\u306f\u5225\u306bWordPress\u306e\u6a19\u6e96\u6a5f\u80fd\u306b\u306f\u5b58\u5728\u3057\u306a\u3044URL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u5834\u5408\u306b\u4f3c\u305f\u3088\u3046\u306aURL\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b\u6a5f\u80fd\u304c\u5099\u308f\u3063\u3066\u3044\u307e\u3059\u3002 \u81ea\u52d5\u88dc\u5b8c\uff08\u6b63\u898f\u5316\u30fb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":20173,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pochipp_cv_data":"","swell_btn_cv_data":"","footnotes":""},"categories":[102],"tags":[],"area":[],"class_list":["post-20171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-troubleshooting"],"_links":{"self":[{"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/posts\/20171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/comments?post=20171"}],"version-history":[{"count":1,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/posts\/20171\/revisions"}],"predecessor-version":[{"id":24347,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/posts\/20171\/revisions\/24347"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/media\/20173"}],"wp:attachment":[{"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/media?parent=20171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/categories?post=20171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/tags?post=20171"},{"taxonomy":"area","embeddable":true,"href":"https:\/\/motoki-design.co.jp\/wordpress\/wp-json\/wp\/v2\/area?post=20171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}