简体   繁体   中英

how do i redirect a specific path to another path in nginx?

I need to redirect a specific path:

mydomain.com/old-path/

to a new path, permanently:

mydomain.com/new-path/

i am using elgg software (elgg.org) and presently when someone navigates to the /old-path/ folder they view a page (rather than a folder listing) - thus no specific page name is used.

i tried the various methods of redirecting that can be found via google for nginx and so far none have had any effect. they mostly are either for a specific page or a directory, yet what i am doing, is, i suppose, technically neither a specific page or a directory..

anyone know how to achieve this? thanks

您可以使用 nginx HttpRewriteModule来执行此操作。

rewrite ^/old-directory/(.*)$ /new-directory/$1 last;

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