Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 28058

Rewrite problem, global/dynamic rules

$
0
0

Hello folk Im trying to achieve a set of rules that makes my webpage a little dynamic in its url.

My goal is having rewritten a couple of urls

mysite.com/default.aspx?action={insert_querystring} == mysite.com/logout/ and mysite.com/signup/ this rule should be regarding the querystring on my default.aspx page

mysite.com/{insert_filename}.aspx == mysite.com/welcome/ and mysite.com/about/ and mysite.com/faq/ well dynamic regarding the filename and removing the extension

and least i want each file to have the possibility of a querystring both regarding filename also:

mysite.com/{insert_filename}.aspx?action={insert} == mysite.com/welcome/johndoe/ and mysite.com/rules/copyright/

Ive been fiddling with this past week now in IIS Url Rewrite Module 2.0, this is my first time playing with these things :) I hope you guys can help me.. Heres a set of rules ive been trying:

<rule name="Remove extension" stopProcessing="false">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}.aspx" appendQueryString="true" />
</rule>

<rule name="Run default querystring" 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="default.aspx?action={R:1}" appendQueryString="true" />
</rule>

<rule name="Everypage querystring" 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="{R:1}.aspx?action={R:2}" appendQueryString="false" />
</rule>

Its pretty close I think.. I know the first set of rules have the same match and I guess thats whats wrong.. But cant seem to figure out what to do, to achieve what i want :)

King regards

aventic


Viewing all articles
Browse latest Browse all 28058

Trending Articles



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