简体   繁体   English

在不更改URL或不执行301的情况下重定向WordPress页面

[英]Redirecting WordPress page without changing the URL or doing a 301

I have a URL like https://mydomain/pages/123_share but the corresponding WordPress page would be https://mydomain/pages/123/ 我有一个类似https://mydomain/pages/123_share但是相应的WordPress页面将是https://mydomain/pages/123/

How can I do this using .htaccess , WordPress wp-engine, etc.? 如何使用.htaccess ,WordPress wp-engine等来执行此操作? Here, the problem is I cannot use 301 redirect. 在这里,问题是我不能使用301重定向。 I need the content of that page served. 我需要该页面的内容。 That means whenever I type the first URL, I need to give the content of the second URL without passing additional HTTP headers or changing the URL. 这意味着每当我键入第一个URL时,都需要提供第二个URL的内容,而无需传递其他HTTP标头或更改URL。

How can I do that? 我怎样才能做到这一点?
Thanks in advance. 提前致谢。

If you have mod_proxy enabled you just use the same kind of rule as you would for an external redirect, but proxy it: 如果启用了mod_proxy ,则只需使用与外部重定向相同的规则,即可代理它:

 RewriteRule ^pages/123_share$ https://mydomain/pages/123/ [NS,P]

The page should should have a <link rel=canonical … for SEO. 该页面应具有<link rel=canonical … for SEO。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM