Score:0

iis - Redirect URL by numeral in order

kg flag

Good afternoon people.

The issue is that I was testing redirecting pages and I ended up having to repeat the code 11 times. But I believe there is a way to automate this. If anyone can help me.

What I want to do is access an address dominio.com/projeto/01/ and he rewrite to dominio.com/projeto/modulo/01 , but I wanted to automate the final part of the url to receive any number and apply that number to the last part of the redirected url

for exemple:

dominio.com/projeto/01/ > dominio.com/projeto/modulo/01

dominio.com/projeto/02/ > dominio.com/projeto/modulo/02

My current web config I do all the links per line

<configuration>
    <system.webServer>
<rewrite>
    <rules>
     <rule name="Projeto" stopProcessing="true">
            <match url="^project/file-01" />
            <action type="Redirect" url="https://dominio.com.br/project/module/file-01/" />
        </rule>
<rule name="Projeto2" stopProcessing="true">
            <match url="^project/file-02" />
            <action type="Redirect" url="https://dominio.com.br/project/module/file-02/" />
        </rule>

    </rules>
</rewrite>
       
     <httpProtocol>
        <customHeaders/>
    </httpProtocol>
    </system.webServer>
</configuration>``` 
Lex Li avatar
vn flag
IIS URL rewrite rules support regular expressions, so you can write a single rule to cover all the cases. Use search engines and you can learn a lot.
I sit in a Tesla and translated this thread with Ai:

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.