Masking url path on IIS server

1


I have a question that I need but to show a path in the url that is more friendly to the user, like this:

link

I wanted to show instead that all this way showed just

link

Just like this site when clicking on any link in the menu.

Note: My server is Windows with IIS, and neither .htaccess nor mod_rewrite works for Apache . Thank you in advance, and if you have not understood or have any questions, just comment.

    
asked by anonymous 01.12.2016 / 15:42

1 answer

3

Using htaccess it is possible to do

<IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteRule ^mercedita/?$ /sites/mercedita/efetuarlogin.asp [NC,L]
</IfModule>

In this way, when there is / mercedita after the .com.br the server will understand that it is the same as /sites/mercedita/efetuarlogin.asp

Here you will be able to understand a little better about the operation link

For ASP IIS to add the following code in its web.config within the <system.webServer> tag:

<rewrite> 
  <rules> 
    <rule name="renomelogin" stopProcessing="true"> 
      <match url="^mercedita$" ignoreCase="true" /> 
      <conditions logicalGrouping="MatchAll"> 
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
      </conditions> 
      <action type="Rewrite" url="/sites/mercedita/efetuarlogin.asp" appendQueryString="true" /> 
    </rule> 
  </rules> 
</rewrite>

Note: If the person type mercedita / a page will not be found, you must add another rule ( <rule> ) with a different name and change the line

    <rule name="renome login com barra" stopProcessing="true"> 
      <match url="^mercedita/$" ignoreCase="true" /> // Adicione a barra no final
    
01.12.2016 / 16:02