Link to home
Avatar of GoodCode
GoodCode

asked on

301 strip aspx from URL in IIS

We changed our blog and now the url's don't have .aspx on the end of them but the URL is still the same otherwise. So

/blog/post/Using-Memory-Theory-to-Increase-Inbound-Results.aspx.

becomes

/blog/tips/using-memory-theory-to-increase-inbound-results

I'd like to 301 all of the old url's to the new link.

This is the rule I tried but it' redirects to the 404 page:

  <rule name="Rewrite old blog to PHP format (compound route)" stopProcessing="false">
          <match url="([^/]+)/([^/\?]+)\.aspx$" />
          <action type="Rewrite" url="index.php?route={R:1}&amp;page={R:2}" redirectType="Temporary" />
        </rule>

Open in new window

Avatar of sykesjs
sykesjs
Flag of United States of America image

To clarify, do all of the old urls include /blog/post and all the new ones are /blog/tips ?
Avatar of GoodCode
GoodCode

ASKER

Oh good catch I didn't even notice that. All of the old url's are blog/post and the new urls are blog/category  but the biggest category is tips so I can just have blog/tips be the default.
I apologize just tested it and it works even if you put post instead of the category.
try to use the built in url mapping in the iis
How would I do that? I'm in the rewrite map section but I'm not sure what to put for the original value and new value.
ASKER CERTIFIED SOLUTION
Avatar of GoodCode
GoodCode

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
It works.