RewriteEngine On Options +FollowSymlinks RewriteRule ^tt/(.*).php tt.php?id=$1
This is my php page: <?php echo "Ok,we are in tt.php<br>"; if(isset($_GET["id"])){echo "Got \$_GET[id]<br>";}else{echo "No \$_GET[id]<br>";} print_r($_GET); print_r($_REQUEST); print_r($_GET['id']); ?>
Ryan,
This would have been solved a lot quicker on a list dedicated to Apache.
I tested this, and it works:
.htaccess --- #Options +FollowSymlinks <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^tt.php/(.*) tt.php?id=$1 RewriteRule ^tt.php/(.*).php tt.php?id=$1 </IfModule> ---
With this tt.php file: --- <h1>tt.php</h1> <pre> <? print_r($_GET); ?> </pre> ---
A few notes:
- I commented out the Options line because *my* Apache set-up doesn't need it, but yours may (it depends on the httpd.conf file).
- I've tested the above with the following URLs: - http://indentclients.com/tests/ryan/tt/45.php - http://indentclients.com/tests/ryan/tt/45 - http://indentclients.com/tests/ryan/tt/45/ - http://indentclients.com/tests/ryan/tt.php/45.php - http://indentclients.com/tests/ryan/tt.php/45 - http://indentclients.com/tests/ryan/tt.php/45/
In all cases, it output: Array ( [id] => 45 )
- it also works for me without the <IfModule...> and </IfModule> lines
- if this STILL doesn't work, it's more than likely that your host does not allow mod_rewrite, doesn't allow you total freedom in your .htaccess file, etc etc -- find a new host.
Justin French
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php