{"id":11363299,"date":"2019-03-27T17:40:54","date_gmt":"2019-03-27T17:40:54","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/redirection-problem-with-similar-urls\/"},"modified":"2019-03-27T17:40:54","modified_gmt":"2019-03-27T17:40:54","slug":"redirection-problem-with-similar-urls","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/redirection-problem-with-similar-urls\/","title":{"rendered":"Redirection problem with similar URL&#8217;s"},"content":{"rendered":"<p>I have strange problem with redirection in WordPress. There are two pages with similar permalink:<\/p>\n<p><code>http:\/\/www.example.com\/finance<\/code><\/p>\n<p><code>http:\/\/www.example.com\/finance-and-accounting<\/code><\/p>\n<p>After entering on <code>\/finance-and-accounting<\/code> address, WordPress redirects to the <code>\/finance page<\/code>.<\/p>\n<p>When I change <code>\/finance-and-accounting<\/code> to, for example <code>\/123finance-and-accounting<\/code> it&#8217;s work fine, but I need current address. I tought that change current address to something working and add redirect from  <code>\/finance-and-accounting<\/code> to new address will good solution but&#8230;<\/p>\n<p>WordPress root folder don&#8217;t have .htacces file, but includes nginx.conf file, so I guess it&#8217;s on nginx server. Important &#8211; this nginx.conf file was empty.<\/p>\n<p>I tried add following code to nginx.conf:<\/p>\n<pre><code>location \/finance-and-accounting {\n  rewrite ^(.*)$ http:\/\/www.example.com\/new-address redirect;\n}<\/code><\/pre>\n<p>and<\/p>\n<pre><code>location http:\/\/www.example.com\/finance-and-accounting {\n  rewrite ^(.*)$ http:\/\/www.example.com\/new-address redirect;\n}<\/code><\/pre>\n<p>also<br \/>\n<code>remove_action(&#039;template_redirect&#039;, &#039;redirect_canonical&#039;);<\/code><br \/>\nin functions.php<\/p>\n<p>But it&#8217;s not work. It still redirect to \/finance page.<\/p>\n","protected":false},"template":"","class_list":["post-11363299","topic","type-topic","status-publish","hentry","topic-tag-htaccess","topic-tag-nginx"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11363299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11363299\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11363299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}