nginx或apache伪静态隐藏文件目录

nginx或apache伪静态隐藏文件目录

问题描述:

目前访问的地址是:https://xxx.xxx.xx.com/de/support/how-to/troubing/?id=213232
想要隐藏掉troubing这个目录,用 https://xxx.xxx.xx.com/de/support/how-to/id=213232
要去掉troubing/?这一截
请问用nginx或者apache怎么实现?

访问https://xxx.xxx.xx.com/de/support/how-to/id=213232
返回https://xxx.xxx.xx.com/de/support/how-to/troubing/?id=213232 的内容

nginx:

 location ^~ /de/support/how-to/ {
        rewrite ^(.*)/([^/]*)$ $1/troubing/?$2 break;
 }
 #配置要放在 location / 前面

nginx 配置 可以试试

location  /de/support/how-to/troubing/ {
   proxy_pass  https://xxx.xxx.xx.com/de/support/how-to/$1$is_args$args
}