2

Can anybody please help me with some URL rewriting?

I have (for example) these pages:

www.mydomain.com/test/gallery.asp?id=2
www.mydomain.com/test/gallery.asp?id=3

and want them to be requested as:

www.mydomain.com/photos/people
www.mydomain.com/photos/wildlife

I'm using IIS and at first my hosting provider was using ISAPI_Rewrite with a httpd.ini file, now they have switched to Helicon Ape with a .htaccess file. See: http://www.isapirewrite.com/ and http://www.helicontech.com/ape/

I tried it the ISAPI_Rewrite way:

RewriteRule /photos/people /test/gallery.asp?id=2 [I,L]
RewriteRule /photos/wildlife /test/gallery.asp?id=3 [I,L]

But it doesn't work.

Suggestions?

waanders
  • 8,907
  • 22
  • 70
  • 102

1 Answers1

5

try this

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^photos/(.*)$ test/gallery.asp?id=$1 [L,QSA]

first row is test if it isn't file

second row is test if it isn't directory

third will redirect photos/wildlife?a=true to test/gallery.asp?id=wildlife&a=true

if you don't want to redirect with a=true, just give out QSA ;)

Jan Šafránek
  • 893
  • 10
  • 13
  • Nope. Doesn't work for me. I tried other examples of the documentation also. No results. Can I check if the rewrite functionality is properly working? – waanders Dec 30 '10 at 14:46
  • It's working now. The provider accidentally turned it off ... $@!*X#!@# – waanders Jan 06 '11 at 14:43