Forum Moderators: open

Message Too Old, No Replies

Beginners guide to "mod rewrite" for ASP site on Microsoft-IIS/5.0

anyone got one

         

Adam_C

3:22 pm on Sep 11, 2003 (gmt 0)

10+ Year Member



I've been told this is the place to post about re-writing urls for an ASP site on IIS... so here goes:

I want to rewite the dynamic urls on a clients ASP site (IIS/5) to static looking urls.
Have never done this before, and am looking for an easy to follow step-by-step guide.

I'm sure there must be some top notch threads in here, but is getting time consuming wading through them all.

Cheers

bakedjake

3:27 pm on Sep 11, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Well, as long as you use one of the mod_rewrite cousins for IIS (iis_rewrite, isapi rewrite), the method will be mostly the same for IIS as it will for Apache. Do remember that the place you insert the rules will depend on which software you're using (you won't be putting them into httpd.conf or .htacess). But the rule generation pretty much sticks either way.

Check out both: Introduction to mod_rewrite [webmasterworld.com]
And: mod_rewrite Documentation [httpd.apache.org]

Also look at anything here by jdMorgan. He's the man.

Adam_C

3:37 pm on Sep 11, 2003 (gmt 0)

10+ Year Member



Is it necessary to get add-on software?

Or does IIS/5.0have all the necessary bits as standard?

bakedjake

3:46 pm on Sep 11, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Nope, you'll have to get software. I mentioned two packages in the post above. There are others.

plumsauce

10:02 am on Sep 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




if it is solely for asp, that is all dynamic,
you can do this by using a custom error handler.

i have seen entire sites done as a single custom
error handler file.

+++

Adam_C

10:40 am on Sep 12, 2003 (gmt 0)

10+ Year Member



plumsauce: any more info on this would be greatly appreciated.

Thanks

georgeek

10:42 am on Sep 12, 2003 (gmt 0)

10+ Year Member



Have a look at IIS Rewrite from Qwerksoft.

plumsauce

4:44 am on Sep 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




eg. using .asp

in mmc register a custom 404 handler of type URL, not file.

create default.asp that you will use for custom error
handler.

eg. /catalogue/default.asp

will catch all errors in /catalogue and lower

in default.asp you will find the failed request string
is readable as a variable, i think http-referer, just
enumerate through them all as an experiment.

parse the failed request to determine the page output.

you may want to use server.execute() to make maintenance
easier

++++

davemarks

10:41 pm on Sep 14, 2003 (gmt 0)

10+ Year Member



Does anyone know if there are any free equivalents to IIS Rewrite?

makeupalley

3:35 pm on Sep 15, 2003 (gmt 0)

10+ Year Member



I've been using this one for a while and I'm very happy with the faetures and performance.

[motobit.com...]

davemarks

3:51 pm on Sep 16, 2003 (gmt 0)

10+ Year Member



Thanks

Have downloaded, will have a play in a mo...

pageoneresults

3:56 pm on Sep 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



ISAPI_Rewrite would be my suggestion. We've tested both IIS Rewrite and ISAPI. The ISAPI_Rewrite product outperforms the others due to its ease of configuration and a bunch of other little extras that come in handy. One of the biggest benefits we've found with ISAPI_Rewrite is that you don't have to restart IIS each time you make a change to the .ini file.

I would stay away from anything that is going to generate a 404 as your log files are going to be littered with 404 requests.

The most important part of this entire process is planning your URI structure. The shorter the string, the better. If you can eliminate any of the variables (directory path) in the URI, go ahead and plan for that now as you'll be able to keep the URI strings short and sweet which makes them very user friendly.

For example, if you can take something like this...

www.example.com/sub/sub/sub/
(The above URI is what you may end up with after a rewrite.)

...and trim out one of the variables so you end up with something like this...

www.example.com/sub/sub/

You'll be much better off in the long run. The goal is to make the URIs as short (and shallow/directory depth) as possible so they are friendly to users and spiders.

davemarks

5:51 pm on Sep 16, 2003 (gmt 0)

10+ Year Member



Ok I tested the latest freeware one and am not very impressed. Theres no algo based rewrites other than converting directories to variables which is no good

Also i can't find the config file anywhere.

So far i favour IIS Rewrite simply because i got it going and doing what i want without problem. I can copy the dll into as many folders as i want to run multiple webs off of it.

ISAPI Rewrite talked of better support for virtual servers but the demo doesn't support this, which makes it hard to test (and this is one of my main criteria)

Not having to restart IIS is a great bonus especially as it won't be approprite in the live enviroment. Plus its only $69 which is pretty good.

pageoneresults whats the virtual server support like? can you dump a config file for each web in its own folder (one below root) for config by the user?

Thanks

pageoneresults

6:12 am on Sep 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



davemarks, sorry for the late reply...

Better support for multiple virtual sites. Just need to drop in "local configuration" file and it's up and running right away. Again, no IIS restart here either.

davemarks

2:14 pm on Sep 20, 2003 (gmt 0)

10+ Year Member



Oh right, that seems pretty good.

Thanks for replying...

Think I may have to get a couple of clients together who would benefit and see if they will absorb the cost.

At the end of the day its only $69 i think...

pageoneresults

2:21 pm on Sep 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Think I may have to get a couple of clients together who would benefit and see if they will absorb the cost.

Hehehe, the $69.00 is pocket change compared to what you will probably charge to set up the config file. There is some planning to do along with URI structuring. The $69.00 can easily be absorbed into the overall proposal for URI Rewriting.

davemarks

12:39 pm on Sep 23, 2003 (gmt 0)

10+ Year Member



If it were a one of project, I expect yes. But its just adding to a couple of smallish sites that would benefit in terms of search engine friendliness. (Product/Accommodation Catalogues etc.)

The config file which liturally be changing say /product255.htm to /product.asp?ref=255 so one line config for each site...

Even so, i guess i could proabably quite easily absorb the costs

Thanks for all your help and suggestions pageoneresults, your experience is much appreciated :)

topr8

11:18 am on Oct 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



am thinking of implimenting isapi_rewrite for my main site, this is on a shared server where i have no access above the root, although the host will install it.

do i understand correctly that once installed i can have the .ini file within my root folder so that i can make changes as i go along if neccesairy without a restart.

davemarks

10:23 pm on Oct 2, 2003 (gmt 0)

10+ Year Member



Thats how i understood it.

pageoneresults is the exper here though