Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前正在研究wordpress。URL 0f 站点是这样的
example.com/dashboard-form/?din=random12。
我希望网址是这样的
example.com/dashboard-form/random。
提前致谢
在初始化时添加:
注册您的自定义变量(问题中的“din”)
add_rewrite_tag('%mycustomvar%','([^&]+)');
创建重写规则:
add_rewrite_rule('^product/([0-9]{1,})/?','index.php?p=4&mycustomvar=$matches[1]','top')
更多内容请参考以下链接:
https://wordpress.stackexchange.com/questions/48487/how-to-retrieve-get-variables-from-rewritten-urls
尝试添加重写规则并让我知道是否有任何查询。