我有下载页面:https://example.com/preview-and-download/?key=123456789我希望用户浏览器为:https://example.com/preview-and-download/123456789我用OpenLitespeed使用Wordpress
我使用这个函数,但是它不工作,
add_filter( 'generate_rewrite_rules', function ( $wp_rewrite ){
$wp_rewrite->rules = array_merge(
['preview-and-download/(d+)/?$' => 'index.php?key=$matches[1]'],
$wp_rewrite->rules
);
} );
我正在寻找帮助与此方法或其他方法创建虚拟url从基页url:https://example.com/preview-and-download/
Many Thanks in Advance.
既然OpenLiteSpeed可以做重写规则,使用这样的东西怎么样?
RewriteRule preview-and-download/(.*) preview-and-download/?key=$1
应该简单地将preview-and-download/something
重写为preview-and-download/?key=something