• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 505
  • Last Modified:

How do I use ISAPI_Rewrite

I just read about this technology and it seems like it can solve almost all my problems as a webmaster....

i have a few questions...

1. I want to change this link....
             http://www.mysite.com/answer.asp?kwds=graphics
                    to
             http://www.mysite.com/graphics.html

How do i do this?


2. How does this work? Do i modify a file on my server?

3. I have 2 sites hosted separately, server A i have ONLY FTP access to. So can i just write a script and upload it? or do i have have to change multiple files.
   
Server B i can ONLY UPLOAD files, minimal FTP access, will just uploading a single script work ?

Please help!!

thanks.
0
mrperfect75000
Asked:
mrperfect75000
  • 10
  • 6
  • 3
2 Solutions
 
DireOrbAntCommented:
Change answer.asp to have only this in the code:
<% Response.Redirect("graphics.html") %>
0
 
mrperfect75000Author Commented:
I dont think that would work because asnwer.asp takes in a variable kwds, so the link could be  

 http://www.mysite.com/answer.asp?kwds=keyword_entered

i want it to be

 http://www.mysite.com/keyword_entered.html

I want to use ISAPI_Rewrite to do that for every key word entered


0
 
DireOrbAntCommented:
That will still work. The simple one-liner ASP page won't care about parameters.
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
DireOrbAntCommented:
Oh, I see, sorry, try:
<% Response.Redirect(Request.QueryString("kwds") & ".html") %>
0
 
mrperfect75000Author Commented:
One problem with that - it redirects to the html page but how can i keep the content in
 http://www.mysite.com/answer.asp?kwds=keyword_entered

the same as


 http://www.mysite.com/keyword_entered.html
now it just redirects and goes to page not found.

thanks
0
 
DireOrbAntCommented:
I'm confused here... You don't want a redirect, those html files don't exists? You just want the URL to change?
0
 
mrperfect75000Author Commented:
SOrry i didnt explain that, those html files dont exist- i want to do a URL rewrite. Same content, I just want to rewrite the url to be static instead of dynamic.
0
 
DireOrbAntCommented:
Interesting, they have to click on that asp link in the first place don't they?

I don't know ISAPI_Rewrite, I guess you went there right?:
http://www.isapirewrite.com/

From what I see, ISAPI_Rewrite will "redirect" to the second URL. It will not simply change the URL you see in the browser.

In fact, it's a security flaw to do so, cause you could "rewrite" it to https://www.yourbank.com and make a darn good spoof site.
0
 
mrperfect75000Author Commented:
I 'll check out that site, i just read that its bpossibly to change dynamic links to static ones and thats all i want to try to do.
0
 
DireOrbAntCommented:
Please point me to that on the isapirewrite site.
It IS possible to change a dynamic link to a static one or a static one to a dynamic one, but the browser will get a redirect and go to the second link. So it needs to exist.
0
 
Dave_DietzCommented:
Let me answer your questions in a different order than you asked:

2. How does this work? Do i modify a file on my server?
- This works by installing a Global ISAPI filter on the server and configuring it properly.  You need to change IIS configuration and modify the configuration file for the ISAPIReWrite filter as well.

3. I have 2 sites hosted separately, server A i have ONLY FTP access to. So can i just write a script and upload it? or do i have have to change multiple files.  Server B i can ONLY UPLOAD files, minimal FTP access, will just uploading a single script work ?
- You will need access to the IIS Management Console - FTP will not allow you to use or configure ISAPIReWrite.  Additionally you will need administrative access to the machine in order to make the changes necessary.

1. I want to change this link....
             http://www.mysite.com/answer.asp?kwds=graphics
                    to
             http://www.mysite.com/graphics.html

How do i do this?
- ISAPIReWrite would be a viable method of doing this - it would be a fairly simple regular expression to write.  You could also use URLRewrite from the IIS 6.0 Resource Kit Tools in a similar manner.

However, from the description you gave you don't have enough access to the server to install or configure either of these solutions.

You will need to speak with your hoster about implementing either of these solutions.

Dave Dietz
0
 
DireOrbAntCommented:
Dave, the page http://www.mysite.com/graphics.html doesn't exist. So I don't think ISAPIRewrite or URLRewrite can do this.

From what I see, mrperfect75000 wants the Browser URL to change to http://www.mysite.com/graphics.html but the executed server-side script still be http://www.mysite.com/answer.asp?kwds=graphics

Is that correct mrperfect75000 ?
0
 
Dave_DietzCommented:
Actually either will be able to do that.  What they do is catch the request at the ISAPI filter level and modify the URL that is actually presented to the W3SVC service which then acts on the modified URL and sends a response back to the client.

The address in the client's browser is unaffected and the content is generated/pulled from whatever URL the filter changes it to.

Dave Dietz
0
 
DireOrbAntCommented:
Right... That's what I'm saying. Sorry if I'm not clear enough.

He wants to change the link from (for example's sake):
http://www.mysite.com/answer.asp?kwds=graphics
to:
http://www.mysite.com/graphics.html

BUT http://www.mysite.com/graphics.html doesn't exist, so IIs won't be able to serve it.

Look at my ASP redirect script, that didn't work for him since the redirect-to page doesn't exist.

Make sense?
0
 
mrperfect75000Author Commented:
Yes I was trying to have the browser change and still have the same content. I want the browser to change because i dont want the user or search engines to see my dynamic links.

But i want the content to stay the same.


If i can do that with an ASP redirect script that would be the best so i wont have to talk to my host
thanks
0
 
DireOrbAntCommented:
mrperfect75000, I'm sorry, but you can't change the browser URL. You don't control that.

So your goal is to avoid search engines? Or do you want search engines to show the link as a static one?

If you DON'T want your site indexed, simply add a robots.txt in your root with:
User-agent: *
Disallow: /

Or if you only want that script out:
User-agent: *
Disallow: /answer.asp
0
 
mrperfect75000Author Commented:
My goal is to not let people change kwds, just because they see asnwer.asp?kwds=graphics, they can just change it to asnwer.asp?kwds=techno and get the right thing. And i also understand search engines dont index dynamic links.

Here is an example of what i'm talking about....

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
0
 
Dave_DietzCommented:
Either ISAPIReWrite or URLRewrite can be used to create a table where a URL such as http://www.mysite.com/graphics.html would be intercepted by the filter and internally changed to http://www.mysite.com/answer.asp?kwds=graphics for the server to act upon.

A simple RegEx something along the lines of match http://www.mysite.com/*.html and translate it to http://www.mysite.com/answer.asp?kwds=%1 would work for ISAPIReWrite.  The rules for URLRewrite are slightly different but could be managed as well.

This would let the user see http://www.mysite.com/graphics.html but the server would act as if it had received http://www.mysite.com/answer.asp?kwds=graphics instead.

This being said, there is no way to set this up or configure it via FTP.  You would have to work with your hosting provider to set this up and if you are not hosting on a dedicated server they will likely not want to install a Global ISAPI filter that can affect all the site on the server.

Dave Dietz
0
 
DireOrbAntCommented:
ISAPIRewrite/URLRewrite and that link you sent all do the same thing, they "redirect" the request in a way.

If your users can't get direclty to a link for security reasons and such, then you need to change your application to avoid that.
As an example, let's say that you pull the kwds from a database, stick a random number in each row and then make the link:
http://www.mysite.com/answer.asp?kwds=graphics&id=48632
When you pull graphics from the DB, you check that the id also match what the table has for graphics, if not, you return an "Invalid Query" page.

As far as search engines not indexing dynamic links... If they can get to it (linked from another page), there is good chance it will be indexed.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 10
  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now