Forum Moderators: phranque
[example.com...]
maps to:
[example.com...]
index.php will include the second page and not the first (I already have code for that) if there id2=anything.
What I need is some way to use mod_rewrite to do this. I don't understand the syntax of it so I'm asking for help here.
[edited by: heini at 8:39 pm (utc) on April 12, 2003]
[edit reason] no urls please / thanks! [/edit]
have a look here:
[searchengineworld.com...]
and search for mod_rewrite, there is quite a lot of comprehensive threads explaining how to use it.
Sorry I'm not a PHP/Apache Guru so I can't help you :)
Leo
<added> you might also want to look at this specialised forum [webmasterworld.com], a lot of threads about mod_rewrite were started there.</added>
The example below should rewrite..
http*//www.site.com/first_id/second_id2
to..
http*//www.site.com/index.php?id=first&id2=second
RewriteEngine On
RewriteRule ^(.*)_id/(.*)_id2$ /index.php?id=$1&id2=$2 [L]
site.com/images/34.jpg
Without the _id, the above url; would be rewritten to:
site.com/index.php?id=images&id2=34.jpg
RewriteEngine On
RewriteRule ^(.*)_id/$ /index.php?id=$1
RewriteRule ^(.*)_id/(.*)_id2$ /index.php?id=$1&id2=$2 [L]
RewriteEngine On
RewriteRule ^/images/(.+) - [PT,L]
RewriteRule ^(.*)/$ /index.php?id=$1
RewriteRule ^(.*)/(.*)$ /index.php?id=$1&id2=$2 [L]
I'm going to go crazy if I don't figure this out.