浏览器访问一个页面,http://abc.com/fanglu-h5,nginx这么配置:
server {
listen 80;
server_name abc.com;
location /fanglu-h5 {
root /home/ctivity/;
index index.html;
}
}
发生301.如下图所示:
不想让他这样,不想发生301再加上斜杠,怎么办呢?这样就行了,花了好几个小时,
server {
listen 80;
server_name abc.com;
rewrite ^/fanglu-h5$ /fanglu-h5/ last;
location /fanglu-h5 {
root /home/ctivity/;
index index.html;
}
}