简体   繁体   中英

Nginx rewrite url args

I have a wordpress website and a I need rewrite:

myurl.com/name-of-my-post/?lang= es

To

myurl.com/ es /name-of-my-post/

I allready try everthing that i can found but not is working

PS I don't need send the lang parameter to index.php becausa there is a plugin that reply to

myurl.com/ es /name-of-my-post/ but not rewrite when a visit come from myurl.com/name-of-my-post/?lang= es

Thanks for the help

A simple fix (which may not work because it is too simple) is to permanently redirect any URI with a lang parameter:

if ($arg_lang) {
    return 301 /$arg_lang$uri;
}

See this caution on the use of the if directive.

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