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

Microsoft IIS Web ServerPHPWeb Servers

Avatar of undefined
Last Comment
GoodCode

8/22/2022 - Mon
sykesjs

To clarify, do all of the old urls include /blog/post and all the new ones are /blog/tips ?
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.
GoodCode

ASKER
I apologize just tested it and it works even if you put post instead of the category.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Kamal Khaleefa

try to use the built in url mapping in the iis
GoodCode

ASKER
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
GoodCode

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
GoodCode

ASKER
It works.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.