如何从重写wordpress rest api的urlhttp://example.com/?rest_route=/wp/v2/
到http://example.com/wp-json/wp/v2/
不更改(默认)永久链接结构?apache(htaccess)需要这个。
在nginx中是这样的:
location ~ ^/wp-json/ {
rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
}
如何从重写wordpress rest api的urlhttp://example.com/?rest_route=/wp/v2/
到http://example.com/wp-json/wp/v2/
不更改(默认)永久链接结构?apache(htaccess)需要这个。
在nginx中是这样的:
location ~ ^/wp-json/ {
rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
}
通过以下行解决:
RewriteEngine On RewriteBase / RewriteRule ^wp-json/(.*) /?rest_route=/$1 [L]
我今天从http更新到https。到目前为止,一切顺利。除了重定向命令外,一切正常。当我点击链接到我博客的外部社交媒体或网站时,仍然使用旧版本的http,它不会被重定向。这是我的文件的一部分的外观:# -FrontPage- IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* <Limit GET POST> order deny,allow deny from all allow