MOD_REWRITE and Windows IIS

Taomyn
Taomyn's picture

Joined: 2003-11-11
Posts: 135
Posted: Mon, 2003-11-17 14:49

Ok, hands up all those that thought I was going ask how to get MOD_REWRITE to work under Windows with IIS?

Well, I'm not, but I am going to say that I've more or less got it working on my server. Just need to test a bit more before I reveal all ;) BTW. This needs additional software on the server so it won't be availble anyone that doesn't have full access to the server, or can't easily get things installed for them :(

The only minor thing that spoils it for normal browsing of the gallery is that the link for "Gallery:" in the gallery gets set to "http://gallery.mydomain.com/albums.php" and it would be neater for it to be just "http://gallery.mydomain.com".

Any chance someone could document what each of the 4 mod_rewrite rules are supposed to achieve, with an example so I can test my setup against it?

Taomyn

 
Taomyn
Taomyn's picture

Joined: 2003-11-11
Posts: 135
Posted: Fri, 2003-12-12 13:47

If anyone wants to know how to set this up let me know here and I'll post the information.

 
h0bbel
h0bbel's picture

Joined: 2002-07-28
Posts: 13451
Posted: Fri, 2003-12-12 18:28

Taomyn, if you'd like, please add a note to the IIS documentation ( http://gallery.sf.net/docs.php ) about this. :)

 
Taomyn
Taomyn's picture

Joined: 2003-11-11
Posts: 135
Posted: Fri, 2003-12-12 23:13

h0bbel, done as requested. :D

Any questions, please feel free to ask here,

Taomyn.

 
h0bbel
h0bbel's picture

Joined: 2002-07-28
Posts: 13451
Posted: Fri, 2003-12-12 23:51

Taomyn, pure greatness. :) I love the additions to the docs. :)

 
u8915055

Joined: 2004-08-10
Posts: 4
Posted: Tue, 2004-08-10 05:03

Hello, I think I followed the instructions properly on how to get mod-rewrite and IIS working.. but how do I know its actually working?
Thanks.
Tom :)

 
h0bbel
h0bbel's picture

Joined: 2002-07-28
Posts: 13451
Posted: Tue, 2004-08-10 06:28

u8915055, what does your URLs look like?

 
Taomyn
Taomyn's picture

Joined: 2003-11-11
Posts: 135
Posted: Tue, 2004-08-10 08:20

Check the HTTPD.INI.ERRORS file in the same directory as the ISAPI_Rewrite programs. It will always change its date/time stamp wheneven IIS runs it (with IIS-6 you need to have called your website at least once as it doesn't load the DLL until it's needed). It will be 0k if all is well or larger and contain any error codes.

BTW. What version of IIS are you using?

 
zman
zman's picture

Joined: 2003-07-24
Posts: 196
Posted: Thu, 2004-10-14 18:21

Hello!

Just wondering if this is still the best/only way to get short URLs on a IIS machine? I have a very modified Gallery that I built on a Apache machine and I'm moving it to a IIS machine so getting these short URLs to work is important for me :D

Also, I will have multiple Gallery installs on the same url. For example, I'll have Gallery installed in both locations...

www.somewhere.com/gallery
www.somewhere.com/pics/gallery

Will the Lite version allow me to have short URLs for both Gallery installs?

How about if, on the same server, I have a URL pointing to a deeper folder? For example...

www.somewhere.com/www/mysite.com/gallery has a URL which is also...

www.mysite.com/gallery

Just wondering if the Lite version will work for that too?

Thanks very much for any info!

BTW, I do have Gallery 1.4.4-pl2 installed and running good on a Windows 2000 machine using IIS. There was some talk about people having trouble with this but it seems to work pretty good so far... with the exception of getting the short URLs to work! :)

 
Taomyn
Taomyn's picture

Joined: 2003-11-11
Posts: 135
Posted: Sat, 2004-10-16 12:34

I can't see there being any problems with multiple, though I suspect you may have to have separate sets of entries for each gallery.

However, I'm not sure I would necessarily set them up in the same way, and would prefer using separate sites for each. For example, where you have:

www.somewhere.com/gallery
www.somewhere.com/pics/gallery

I would set up

gallery.somewhere.com
pics.gallery.somewhere.com or just pics.somewhere.com

This keeps them totally separate.

(note each would site would point to the same place as yours so both links would work, but mine allows for simpler rules I think)

If you do have more difficulties, visit the ISAPI_REWRITE forums and hunt out my thread where they kindly wrote the original settings for me. Add what you want to achieve and they can hopefully sort you out.

 
zman
zman's picture

Joined: 2003-07-24
Posts: 196
Posted: Wed, 2004-10-20 22:48

For some reason, I could not get what you listed in the installation documentation to work. Even with just a single Gallery install??? :(

However, with some help from the excellent ISAPI_Rewrite team, we did get it to work! Here is what I ended up with...

RewriteCond Host: www\.mysite\.com
RewriteRule /gallery/([^.?/]+)/(\d+)(\?.*)? /gallery/view_photo.php(?3$3&:\?)set_albumName=$1&index=$2 [I,L]

RewriteCond Host: www\.mysite\.com
RewriteRule /gallery/([^.?/]+)/(\w+)(\?.*)? /gallery/view_photo.php(?3$3&:\?)set_albumName=$1&id=$2 [I,L]

RewriteCond Host: www\.mysite\.com
RewriteRule /gallery/([^.?/]+)/$ /gallery/$1 [I,R]

RewriteCond Host: www\.mysite\.com
RewriteRule /gallery/([^.?/]+)(\?.*)? /gallery/view_album.php(?2$2&:\?)set_albumName=$1 [I,L]

The above works assuming your Gallery is installed at www.mysite.com/gallery

The rules above are very close to what you originally had posted but a little different. The ISAPI_Rewrite Team also said the above would work for me for doing the multiple Gallery installs using the same URL but in different folders. I'd just have to modify the rule directory stucture a little. WOOHOO! :)

Thanks very much for getting this going and pointing me in the right direction. This has saved me a TON of time in not having to rewrite a bunch of code to make my modified gallery work with long URLs!!!

 
dollie

Joined: 2009-07-03
Posts: 1
Posted: Fri, 2009-07-03 11:06

Hi guys,

I am not getting how to do mod_rewrite in IIS server. Can anyone please help me out :-(

Thanks