.htaccess rules in subdirectory

I’m a newbie at .htaccess/Apache configuration. I have a web application that sites inside a subdirectory of the domain (e.g. www.example.com/ttb).

I want to redirect any requests to www.example.com/ttb/page/87 to www.example.com/ttb/page.php?id=87.

Here’s my .htaccess that sites in the subdirectory (/ttb):

Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteRule ^page/([0-9]+)$ /page.php?id=$1 [NC,L]

However, it’s not working. I wrote a simple page.php that prints out the GET variable “id,” but nothing prints. Any ideas?


Welcome to SitePoint’s Apache forum!

I think that your .htaccess code is basically okay:

Options +FollowSymLinks
Options +Indexes
[indent]I prefer -Indexes[/indent]
RewriteEngine On
RewriteRule ^page/([0-9]+)$ [COLOR="Red"]/[/COLOR]page.php?id=$1 [[COLOR="Red"]NC[/COLOR],L]
# The No Case flag does NOT help a RewriteRule!  However, you can check your redirection by using R=301 in its place.