0

I am looking for a rewrite URL tag for such conversion

www.example.com/subject.aspx?subject=aa&page=1

to

www.example.com/subjects/aa/1

I tried to add 2 dollars but it showed error in visual studio and it does not let me compile the solution.

0

2 Answers 2

3

Try this:

<rewrite url="^~/subjects/([A-Za-z]+)/([0-9]+)$" to="~/subject.aspx?subject=$1&amp;page=$2"/>
Sign up to request clarification or add additional context in comments.

10 Comments

I am looking out for something like <rewrite url="~/subjects/(.+)/([0-9]+)" to="~/subject.aspx?ebook-subject=$1&amp;page=$2"/>
Ooops sorry I wrote reverse what you wanted ;-)
Okay I reversed my answer :-)
Hello, I also had a typo in my question, Please see the update in bold and update your answer.Thanks
Oh sure, I see now, updated :-) PS. That's why I "love" regexes, they are so "clear" ;-)
|
0

Maybe it's because you're using "/" in your rewrite rule so it creates "virtual directories", one way to bypass this is by using html tag base href.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.