Solved

How do I use ISAPI_Rewrite

Posted on 2006-07-23
19
471 Views
Last Modified: 2008-01-09
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
Comment
Question by:mrperfect75000
  • 10
  • 6
  • 3
19 Comments
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17164051
Change answer.asp to have only this in the code:
<% Response.Redirect("graphics.html") %>
0
 

Author Comment

by:mrperfect75000
ID: 17164144
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
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17164498
That will still work. The simple one-liner ASP page won't care about parameters.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17164501
Oh, I see, sorry, try:
<% Response.Redirect(Request.QueryString("kwds") & ".html") %>
0
 

Author Comment

by:mrperfect75000
ID: 17164823
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
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17165200
I'm confused here... You don't want a redirect, those html files don't exists? You just want the URL to change?
0
 

Author Comment

by:mrperfect75000
ID: 17165217
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
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17165245
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
 

Author Comment

by:mrperfect75000
ID: 17168107
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
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17169081
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
 
LVL 34

Expert Comment

by:Dave_Dietz
ID: 17171776
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
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17172072
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
 
LVL 34

Expert Comment

by:Dave_Dietz
ID: 17172188
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
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17172337
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
 

Author Comment

by:mrperfect75000
ID: 17172942
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
 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 17173274
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
 

Author Comment

by:mrperfect75000
ID: 17173344
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
 
LVL 34

Accepted Solution

by:
Dave_Dietz earned 300 total points
ID: 17173361
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
 
LVL 26

Assisted Solution

by:DireOrbAnt
DireOrbAnt earned 200 total points
ID: 17173387
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Configure WPAD via DNS 3 80
HTTP Error 403.14 - Forbidden 5 56
IIS 7.5 to 8.0 6 110
IIs Windows 2008 HTTPS no access 4 36
Logparser is the smartest tool I have ever used in parsing IIS log files and there are many interesting things I wanted to share with everyone one of the  real-world  scenario from my current project. Let's get started with  scenario - How do w…
First of all, clustering IIS is something you should rarely consider doing. In almost all cases, Microsoft Network Load Balancing (NLB) (http://technet.microsoft.com/en-us/library/cc758834(WS.10).aspx) is a much better solution when you need to p…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question