[英]WordPress redirect rule in nginx
I have Wordpress .htaccess
where I have written a redirect rule. 我有Wordpress
.htaccess
,我在其中编写了重定向规则。 It is working perfectly. 运行良好。 But now I am hosting the site in nginx.
但是现在我在nginx中托管该网站。 Where I came to know, there is no
.htaccess
. 我知道的地方没有
.htaccess
。 So I got a file named default
in /etc/nginx/sites-enabled/
. 所以我在
/etc/nginx/sites-enabled/
得到了一个名为default
的文件。 In this file I have to write. 在这个文件中我必须写。
But after written the redirect rule, nothing is happened. 但是在编写了重定向规则之后,什么也没发生。
I have written in .htaccess
like this 我这样写在
.htaccess
RewriteRule ^business/([^/]*)/([^/]*)$ /business-profile/?id=$1 [L,P]
And now written in default
file like this: 现在以这样的
default
文件编写:
# nginx configuration
location /business {
rewrite ^/business/([^/]*)/([^/]*)$ /business-profile/?id=$1 break;
}
But cant get any result. 但无法获得任何结果。 Is there anything I left ?
我还剩下什么吗? Please help.
请帮忙。
# nginx configuration
location /business {
rewrite ^/business/([^/]*)/([^/]*)$ /aimber/business-profile/?id=$1 break;
}
I think you forgot "/aimber", the above should work. 我认为您忘记了“ /琥珀色”,以上应该可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.