关于NGINX中的rewrite问题
请教下大家,系统linux,其中nginx安装路径在/usr/local/nginx,另外根路径下还有个html文件夹(/html/bbb/notice.html),当URI中带有/bbb字样的时候,跳转到/html/bbb/notice.html,这个该怎么写,试了很多种方法都不行,要么404,要么重定向一直循环,谢谢。server {
listen 80;
server_name127.0.0.1;
access_loglogs/host.access.logmain;
location ^~ /bbb{
rewrite / http://aaa.com/bbb/notice.html;
break;
}
location/ {
root /html;
index index.html index.htm;
}
error_page404 /404.html;
location /404.html {
#root /html/error;
rewrite / http://aaa.com/error/404.html;
}
error_page 500 502 503 504/50x.html;
location = /50x.html {
#root html;
rewrite / http://aaa.com/error/50x.html;
}
}
已解决,加个root 路径 非常的好,好到非常啊 把rewrite去掉,直接加上root /html/bbs;index index.html
页:
[1]