Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on a project and have implemented successful rule for the url rewriting for the url to be displayed as

http://www.domainname.com/shop/shopname

and I was trying to have this like
http://www.doaminname.com/shopname

and I can render the shop page according to its page name. Means I do not want /shop/ in between. Many rules I had tried but no luck. I would appreciate any help in this

Thanks.
Posted
Updated 24-Apr-12 3:06am
v2

1 solution

I think something like this will do it
XML
<rewrite>
  <rules>
    <rule name="Rewrite to article.aspx">
      <match url="^/([_0-9a-z-]+)" />
      <action type="Rewrite" url="yourshoppage.aspx?shopname={R:1}" />
    </rule>
  </rules>
</rewrite>


please check if you have other rules because the order might be affecting that. Also check your regex etc.

hope it helps
 
Share this answer
 
Comments
Sandeep Mewara 24-Apr-12 10:14am    
5!
Ra-one 25-Apr-12 6:54am    
Thanks for your time but I had already tried this solution, but the problem is for other pages like http://www.domainname.com/about-us.aspx it redirect it to the myshoppage.aspx
[no name] 25-Apr-12 9:50am    
just update the regular expression to something that DOES NOT ends with .aspx, so your regular pages will work and only things with /something will go to yourshopage.aspx?shopname=something. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900