I moved my blog posts from the root of my website to a folder. I want to include a rule in my site's web.config that redirects permanently the posts from their old root location to the new folder location.
All posts have filenames of the following form, a form no other files on my website have, and the filenames are the same in the new folder location as they were in the old root location:
ROJR####.htm or ROJR####-#.htm
As a newbie to both web.config and regex, I am struggling to code accurately the pattern for the match url, as well as the pattern for the redirected url.
My current code is:
<rule name="redirect ROJR" stopProcessing="true">
<match url="^(ROJR\d\d\d\d-?\d?\.htm)$" ignoreCase="true" />
<action type="Redirect" url="^OJRU\/{R:1}" redirectType="Permanent" />
</rule>
Here are my questions:
Match URL: Did I accurately describe the pattern? And will the pattern look only for posts previously located in the root (and not find the moved posts with the same name in the OJRU folder)?
Redirected URL: Did I redirect accurately the old URLs to the new location?
FROM: example.com/ROJR####-#.htm
TO: example.com/OJRU/ROJR####-#.htm
and
FROM: example.com/ROJR####.htm
TO: example.com/OJRU/ROJR####.htm
Thanks for your help.