简体   繁体   中英

Drop last part of URL with Nginx rewrite

If I have the following URL:

https://kl-office.com/directory

How can I configure Nginx to rewrite the above URL as:

https://kl-office.com

You could try this:

rewrite ^.*$ / permanent;

Although, this will rewrite any request to /

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM