1
votes

We have our URL rewrite as followed. I tested the pattern in IIS 8.5 URL Rewrite and the patterns matched as what we wanted. However, it's 404 every single time. Will someone take a look and see what is wrong with my URL rewrite? Thank you.

URL: devbox.mysite.com/article/how-to-use-onedrive

Pattern: (.*)/article/(.*)$
Action Rewrite URL: {R:1}/article/?artID={R:2}

Currently the page shows 404. Below is the XML code in web.config file.

<rule name="Article-rewrite" enabled="true">
    <match url="(.*)/article/(.*)$" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
    <action type="Rewrite" url="{R:1}/article/?artID={R:2}" appendQueryString="false" />
</rule>
1
Can you add some more detail on what you want to achieve and your exact rule XML. At the moment it looks like your destination URL is devbox.mysite.com/article/?artID=how-to-use-onedrive does that work when you browse to it? - NikolaiDante
Yes, if I browse to the URL devbox.mysite.com/article/?artID=how-to-use-onedrive on any browser, it works fine. But I want it to work when the user type in devbox.mysite.com/article/how-to-use-onedrive on the browser. - 2myCharlie

1 Answers

1
votes

Try this:

<rule name="Article-rewrite" enabled="true"> 
    <match url="article/(.*)$" /> 
    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" /> 
    <action type="Rewrite" url="article/?artID={R:1}" appendQueryString="false" /> 
</rule>

I've removed the domain from the match url, as you're not switching the domain.