我想重定向我的网站。com/任意名称。html到我的网站。com/product/anyname,为此我在函数中编写了以下查询。php。但它不起作用。请参阅下面的我的代码
function custom_rewrite_basic() {
add_rewrite_rule(\'^(.*)\\.html$\', \'/product/$1\');
}
add_action(\'init\', \'custom_rewrite_basic\');
请帮助解决此问题。我想重定向我的网站。com/任意名称。html到我的网站。com/product/anyname,为此我在函数中编写了以下查询。php。但它不起作用。请参阅下面的我的代码
function custom_rewrite_basic() {
add_rewrite_rule(\'^(.*)\\.html$\', \'/product/$1\');
}
add_action(\'init\', \'custom_rewrite_basic\');
请帮助解决此问题。或者您可以将相关指令添加到.htaccess
直接归档。例如:
RewriteRule ^([^/]+)\\.html$ /product/$1 [R=302,L]
这与/anyname.html
(如您的示例所示),但不是/foo/bar/anyname.html
.我需要帮助重定向我的页面。例如,我有网站https://example.com. 我需要将内容从https://example.com 到https://example.com/blog. 这不是问题,我通过更改主页URL来做到这一点。这很有效。但现在我需要添加来自旧的重定向https://example.com 到https://xmpl.com.我想用。htaccess,但这不起作用。你们能帮帮我吗?以下是我对此的一些尝试,但两者都不起作用。RewriteEngine On RewriteRu