URL redirection through web.config

0

I need to perform a redirect, from page http://exemplo/comunicacao/ to page http://exemplo/caminho_novo/comunicacao .

I'm doing the following in web.config :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <system.webServer>
       <defaultDocument>
            <files>
                <add value="index.aspx" />
            </files>
        </defaultDocument>
      <httpRedirect enabled="true" destination="/caminho_novo/comunicacao$Q" httpResponseStatus="Permanent" />    

   </system.webServer> 
</configuration>

So far so good, but the problem is that people are calling the page already with parameters filled, and after the path /comunicacao I have a asp called exibe.asp which receives parameters to display the content. / p>

Doing this as configured in web.config , url is set up as follows: exemplo/caminho_novo/comunicacao/?id=136923/exibe.asp

That is, the parameter is coming before the page asp , the right would be:

exemplo/caminho_novo/comunicacao/exibe.asp?id=136923

Can anyone help me?

    
asked by anonymous 02.03.2018 / 17:08

2 answers

1

You have to add $V , which is the url path with page before $Q which is querystring , exactDestination="true" , which informs you that it will be an absolute path and not relative:

<httpRedirect enabled="true" 
              destination="/caminho_novo/comunicacao$V$Q" 
              exactDestination="true"
              httpResponseStatus="Permanent" />
    
02.03.2018 / 17:12
1

$ Q just introduces the querystring, I have no idea who is entering the exibe.asp in front of everything. There are several variables you can use to build your URL with HttpRedirect as it says on the Microsoft reference page.

link

Give me ideas that you're asking to put $ Q before the page name.

  

Passes the requested URL, without the server name and without any   parameters. To include parameters, use the $ P or $ Q variable with the   $ V variable.

Experiment with the example that comes in the documentation, such as: / new_path / communication $ S $ Q

    
02.03.2018 / 17:21