简体   繁体   English

Wordpress中单个页面的自定义永久链接

[英]Custom permalinks for single page in Wordpress

What I'm trying to achieve is having a single Wordpress page that would "manage" multiple child paths: 我要实现的目标是拥有一个可以“管理”多个子路径的单个Wordpress页面:

/blog_url/user/john

and

/blog_url/user/steve

both paths call the same page /about?name= john or steve. 这两个路径都调用同一页面/about?name= john或steve。

Is this possible in Wordpress or does it need a custom ReWriteRule? 是否可以在Wordpress中使用它,还是需要自定义ReWriteRule? If neither, what is the best way to accomplish this? 如果两者都不是,最好的方法是什么?

You do need a custom rewriterule in your htaccess to do that. 您确实需要在htaccess中使用自定义重写器来执行此操作。 Something like: 就像是:

RewriteRule ^user/([^/]+)/ /user/?name=$1 [NC]

And then you would use $_GET['name'] and use it in your page's code 然后,您将使用$ _GET ['name']并将其用于页面代码中

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

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