简体   繁体   English

替换/重定向包含锚链接 (#) 的 URL

[英]Replace/Redirect URL which include anchor link (#)

I'm using Wordpress website.我正在使用 Wordpress 网站。 I want to redirect the old url example.com/submenu/7?s=question#anchor_top to example.com/one/two/我想将旧的 url example.com/submenu/7?s=question#anchor_top 重定向到 example.com/one/two/

This cannot be done through .htaccess because of the #, so I guess have to enter a javascript code into the .由于 #,这不能通过 .htaccess 完成,所以我想必须在 .htaccess 中输入一个 javascript 代码。

I tried this: .htaccess redirect anchor page/page#anchor to url but it was redirecting to example.com/one/two/?s=question#anchor_top我试过这个: .htaccess 重定向锚页面/页面#anchor 到 url但它被重定向到 example.com/one/two/?s=question#anchor_top

Any help please?请问有什么帮助吗?

it' two way to possible.这是可能的两种方式。

  1. add rewrite rule添加重写规则
  2. redirection Plugin.重定向插件。

try this plugin试试这个插件

i) https://wordpress.org/plugins/redirection/ i) https://wordpress.org/plugins/redirection/

Read this article.阅读这篇文章。

ii) https://codex.wordpress.org/Rewrite_API/add_rewrite_rule ii) https://codex.wordpress.org/Rewrite_API/add_rewrite_rule

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

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