mod_rewrite [RESOLVED]

LeetestUnleet

Senior member
Aug 16, 2002
680
0
0
I need the following requested (example) URL:
http://domain.com/5

To transparently redirect to:
http://domain.com/index.php?id=5

index.php is currently just outputting a print_r($_GET).

Below is the contents of the localized .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /aaronb/temp

RewriteRule ^(.*)/ index.php?id=$1 [L]
RewriteRule ^(.*) index.php?id=$1 [L]

Instead of index.php outputting
Array ( [id] => 5 )

It's outputting
Array ( [id] => index.php )



I know there's something wrong with my Regex, but I don't understand it well enough to fix it. Any thoughts?
 

LeetestUnleet

Senior member
Aug 16, 2002
680
0
0
Nice! That cheat sheet helps a lot.

For reference, if anyone comes across this in a search later, this is the working .htaccess


Options +FollowSymLinks
RewriteEngine on
RewriteBase /aaronb/temp

RewriteRule ^([0-9]+)/?$ index.php?id=$1