Re: mod_rewrite fun
Robby Russell <[email protected]>
| Newsgroups | gmane.org.user-groups.linux.pdxlug |
|---|---|
| Organization | PLANET ARGON |
| Message-ID | <1089046709.424.34.camel@vacant> |
On Mon, 2004-07-05 at 09:40, Cory Bertsch wrote: > > Actually, I hadn't really known what it did until this weekend. I > > figured it out. It's working now, just the way I wanted it to. :-) > > Robby, > > Would you care to send the code this way? I'm not sure how to do that in > mod_rewrite... > > Thanks! > > -Cory RewriteEngine on # Rewrites mydomain.com/testpage/3/ to # mydomain.com/index.php?page=testpage&id=3 # This handles numeric values for $2 RewriteRule ^(.*)/([0-9]+)/$ index.php?page=$1&id=$2 [L] # Rewrites mydomain.com/testpage/foo/ to # mydomain.com/index.php?page=testpage&name=foo # This handles any type of value for $2 RewriteRule ^(.*)/(.*)/$ index.php?page=$1&name=$2 [L] # Just an example of a specific case when I want to bypass the # rule after this one. I want admin/ to go to "admin/" not # index.php?page=admin RewriteRule ^admin/$ admin/ [L] # foo/ to index.php?page=foo RewriteRule ^(.*)/$ index.php?page=$1 -- Robby Russell | Owner.Developer.Geek PLANET ARGON | www.planetargon.com Portland, OR | [email protected] 503.351.4730 | blog.planetargon.com