Rule Rewrite Changing scripts directories

1

I have the following problem, while using the rule below my default directory is changed and my js and css files stop working.

<rule name="Produtos Detalhe">
   <match url="^(produto)\/(.*)\/(.*)\/?$"  />
   <action type="Rewrite" url="/Produto/Detalhe?id={R:3}"  />
</rule>

Example, this code:

<link href="@Href("~/Content/Site/css/bootstrap.min.css")" rel="stylesheet">

It looks like this after rendering:

<link href="/produto/Content/Site/css/bootstrap.min.css" rel="stylesheet">

I would like you to stay:

<link href="/Content/Site/css/bootstrap.min.css" rel="stylesheet">
    
asked by anonymous 05.12.2017 / 18:44

1 answer

0

It's simple. Your rule is as a rule, in the base, the product directory. as you yourself can see, any and all url you use will automatically always have that.
You try to create a universal rule. And with the data collected you try to know where it is going in the system, if it is for products you ai yes, use the dir / products and otherwise /. I did this in apache but in asp I do not know. I'm just trying to give you a light.

Try to leave it like this: ^(.*)\/(.*)\/?$ and then you create the code rules aside to know if you are in the dir products.

    
08.12.2017 / 15:33