Score:0

How to redirect a specific list of webpages to a subdirectory

za flag

I am moving some blog articles from the root directory to a subdirectory named blog/. How do I configure Nginx to permanently redirect a specific list of web pages to that subdirectory?

Of course, I could manually do something like the configuration shown below, but I have more than 50 webpages at the root that I want to redirect to the blog/ subdirectory. Is there a simpler way?

location = /first-article/ {
    return 301 /blog/first-article/;
}

location = /second-article/ {
    return 301 /blog/second-article/;
}

location = /third-article/ {
    return 301 /blog/third-article/;
}

# etc.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.