SolveErrors
ASP

IIS: web.config redirect to another url preserving the original one in the address bar

162 views

I'm trying to understand how to do this, but seems very complicated (at least for someone like me having no experience with IIS but only Apache). I'm porting a website from Linux to a Windows server, and on linux server I have an .htaccess that helps me rewriting urls to hide pages and arguments:

RewriteRule ^store/([0-9a-zA-Z]+)$ http://www.domain.com/store/$1/ [R]

RewriteRule ^store/([0-9a-zA-Z]+)/$ http://www.domain.com/pages/store.asp?name=$1

RewriteRule ^store/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ http://www.domain.com/store/$1/$2/ [R]

RewriteRule ^store/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)/$ http://www.domain.com/pages/store.asp?name=$1&page=$2

So that when someone visits http://www.domain.com/store/client1/ is visiting http://www.domain.com/pages/store.asp?name=client1 (and so on with up to 4 arguments), but in the browser addressbar the url shown is still http://www.domain.com/store/client1/

I can't find my way to do the same on IIS 7...I made something like below:

            
                
                
            
            
                
                
            
            
                
                
            
            
                
                
            

This works for redirecting, so if I call www.domain.com/store/arg1/arg2/ I'm visiting www.domain.com/pages/store.asp?name={R:1}&page={R:2} , but in the browser addressbar I see the redirected address store.asp?name={R:1}&page={R:2} instead of the original www.domain.com/store/arg1/arg2/ , that instead what I need.

Is there a way to do this? I spent already several hours without a working solution...

More ASP fixes

Get actual URL from address bar in Classic ASP on a 404 redirected pageRequested operation requires a current record.asp guestbook w/ textfileguestbook enties - tutorialsadd asp.net pages to an asp classic websitesimple asp based guestbook