Quantcast
Channel: URL Rewrite Module
Viewing all articles
Browse latest Browse all 2482

Installed Rewrite module 2.0 but it doesn't work after creating the rules "Error 404"

$
0
0

I have installed the "URL Rewrite Module 2.0" on WinServ2008 R2, IIS 7, and I need to make my URL more readable(SEO) and I want to avoid to see the QueryString in my URI.

This is what I've found in the Web.Config after creating the first 2 rules and it seems everything everywoks fine only with this 2 whilst... 

<rewrite><outboundRules><preConditions><preCondition name="ResponseIsHtml1"><add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /></preCondition></preConditions></outboundRules><rules><rule name="RedirectUserFriendlyURL1" stopProcessing="true"><match url="^cerca-per-tipologia\.aspx$" /><conditions><add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /><add input="{QUERY_STRING}" pattern="^tipologia=([^=&amp;]+)$" /></conditions><action type="Redirect" url="{C:1}" appendQueryString="false" /></rule><rule name="RewriteUserFriendlyURL1" stopProcessing="true"><match url="^([^/]+)/?$" /><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><add input="{URL}" pattern="\.axd$" negate="true" /></conditions><action type="Rewrite" url="cerca-per-tipologia.aspx?tipologia={R:1}" /></rule></rules></rewrite>

... when I apply the others 2 rules (rewrite and redirect as you can see the code below) the browser stops to show CSS and all components of the page, just plain text and the URI is www.example.com/3209/1254/ in a next step I would get something like www.example.com/namepage/ I don't know if it is feasible.

 but doesn't show error messages and only in the browser's dev tool I can see alll the error messages for all my internal links like (.JS .CSS .JPG and so on), the error is:

(Failed to load resource: the server responded with a status of 404 (Not Found)

This is what I get. Wrong:  http://www.example.com/3209/MyStylesheet.css

This is what I expect. Right http://www.example.com/MyStylesheet.css

What I should modify in order to fix this, is driving me nuts :-) 

I have tried to modify the condition from ^POST% into ^GET$ but it doesn't work.

Please if you can have a look and give me a hand to understand where I am wrong, I will appriciate. Thank you in advance.

<rewrite><outboundRules><preConditions><preCondition name="ResponseIsHtml1"><add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /></preCondition></preConditions></outboundRules><rules><rule name="RedirectUserFriendlyURL1" stopProcessing="true"><match url="^cerca-per-tipologia\.aspx$" /><conditions><add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /><add input="{QUERY_STRING}" pattern="^tipologia=([^=&amp;]+)$" /></conditions><action type="Redirect" url="{C:1}" appendQueryString="false" /></rule><rule name="RewriteUserFriendlyURL1" stopProcessing="true"><match url="^([^/]+)/?$" /><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><add input="{URL}" pattern="\.axd$" negate="true" /></conditions><action type="Rewrite" url="cerca-per-tipologia.aspx?tipologia={R:1}" /></rule><rule name="RedirectUserFriendlyURL2" stopProcessing="true"><match url="^scheda-articolo\.aspx$" /><conditions><add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /><add input="{QUERY_STRING}" pattern="^codicearticolo=([^=&amp;]+)&amp;id=([^=&amp;]+)$" /></conditions><action type="Redirect" url="{C:1}/{C:2}" appendQueryString="false" /></rule><rule name="RewriteUserFriendlyURL2" stopProcessing="true"><match url="^([^/]+)/([^/]+)/?$" /><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /></conditions><action type="Rewrite" url="scheda-articolo.aspx?codicearticolo={R:1}&amp;id={R:2}" /></rule></rules></rewrite>


Viewing all articles
Browse latest Browse all 2482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>