On Sat, Jan 24, 2004 at 12:18:36PM -0500, Monty wrote:
>
>     From This:  articles.php?id=999
>     To This:    articles/999
...
> What am I doing wrong??

I suspect you may not be looking at the problem the right way.

What exactly do you want to do?

Normally, you'd go the other direction; that is, you'd have mod_rewrite
recognize ^/articles/([0-9]+)$ and translate it to /articles.php?id=$1
... so that a request to the "pretty" URL gets served as an HTTP GET on
the PHP script.

I get the impression that you're expecting mod_rewrite to translate copy
from inside your HTML files, as well as recognize and reverse the
translation when the request comes back in.  Is that it?

>     RewriteEngine on
>     RewriteRule ^articles\.php\?id=([0-9]+)$ articles/$1 [R]

> But I keep getting a 404 error for articles.php, which means that something
> must be wrong with my RewriteRule because it's not matching. I've tried
> various tweaks and just can't get it to work.

I bet if you create an "articles" directory in your documentroot, with
with files named things like "999" in it, you'll stop seeing the 404's.
Check your apache error_log.

If what you're trying to achieve is to have existing HTML files get
their embedded URLs translated, you're going to have to do that with an
output filter.  You can do it with PHP, or use mod_sed ... lots of
options.  But a rewrite rule won't change page content, it'll only
rewrite the *requests* that come in.

Of course, if you know all this already, and really are trying to point
requests for /articles.php?id=123 to a file named "123" in the directory
"articles", then you'll still need to inspect your error_log.

-- 
  Paul Chvostek                                             <[EMAIL PROTECTED]>
  it.canada                                            http://www.it.ca/
  Free PHP web hosting!                            http://www.it.ca/web/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to