Mac mod_rewrite problem

To date, all of the web sites I’ve made have been coded on my FreeBSD server via a remote terminal. But now that I’m traveling a lot more, I thought it would be useful to do the entire site I’m currently working on with my MacBook Pro so that I can make use of the increasing amount of spare time I have that coincides with not being able to connect to the internet. Then once I’m ready I can upload the entire thing. That’s the theory, anyway.

PHP, MySQL, and Apache are all working fine on the MBP. Everything’s been going well for the last couple of weeks. But now I’m at the point where I’d like to optimize some links with mod_rewrite, and things aren’t going well at all.

Here’s what’s in my mod_rewrite file right now:


RewriteEngine On
RewriteRule ^index.php article.php?ID=96
RewriteRule ^article/(.*) article.php?ID=$1

Basically, it’s the third line that’s giving me fits.

I want requests to /article/96 to spit out content from /article.php?ID=96.
The line works fine on my FreeBSD server, but not on my Mac running Snow Leopard.

I know that mod_rewrite is working on the Mac because the second line is a test, and it successfully spits out the content from /article.php?ID=96 to people who request /index.php. Also, phpinfo() shows that mod_rewrite is loaded.

I know the server software on the Mac is a newer version than what’s on my FreeBSD box, but I wouldn’t think that the mod_rewrite syntax would have changed all that much.

Any thoughts?

Thoughts? Terminate the first mod_rewrite block statement (the first RewriteRule) with a Last flag (that’s [L]). That operates the same way that ; does in PHP (or, if you’re using RewriteCond statements, too, it operates like } in PHP to close a block statement).

Regards,

DK