[EMAIL PROTECTED] use mod_rewrite to answer a.php?xyz and serve /xyz ?

2008-07-14 Thread Randy Grimes
Hi, I know mod_rewrite can answer web request to /xyz and internally serving
a.php?xyz .  However, is it possible to answer a.php?xyz and internally
serving /xyz , without writing a script a.php?  For the curious minds, we
are moving from dynamic scripts to pre-generated static pages, and want to
maintain old links to outside.

Thanks for your time, Randy


[EMAIL PROTECTED] Re: use mod_rewrite to answer a.php?xyz and serve /xyz ?

2008-07-14 Thread Randy Grimes
I tried, and apache complained "a.php was not found on this server."  Seems
that apache took this as a script instead?

On Mon, Jul 14, 2008 at 5:07 PM, Randy Grimes <[EMAIL PROTECTED]>
wrote:

> Hi, I know mod_rewrite can answer web request to /xyz and internally
> serving a.php?xyz .  However, is it possible to answer a.php?xyz and
> internally serving /xyz , without writing a script a.php?  For the curious
> minds, we are moving from dynamic scripts to pre-generated static pages, and
> want to maintain old links to outside.
>
> Thanks for your time, Randy
>


Re: [EMAIL PROTECTED] use mod_rewrite to answer a.php?xyz and serve /xyz ?

2008-07-15 Thread Randy Grimes
Works like a charm.  Thanks a lot for your help, now I feel like able to do
anything with it.

Now I can understand that dry paragraph:
Note: Query String

The *Pattern* will not be matched against the query string. Instead, you
must use a 
RewriteCond<http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritecond>with
the
%{QUERY_STRING} variable. You can, however, create URLs in the substitution
string, containing a query string part. Simply use a question mark inside
the substitution string, to indicate that the following text should be
re-injected into the query string. When you want to erase an existing query
string, end the substitution string with just a question mark. To combine a
new query string with an old one, use the [QSA] flag.

Best, Randy

On Tue, Jul 15, 2008 at 3:36 AM, Krist van Besien <[EMAIL PROTECTED]>
wrote:

> On Mon, Jul 14, 2008 at 23:07, Randy Grimes <[EMAIL PROTECTED]>
> wrote:
> > Hi, I know mod_rewrite can answer web request to /xyz and internally
> serving
> > a.php?xyz .  However, is it possible to answer a.php?xyz and internally
> > serving /xyz , without writing a script a.php?  For the curious minds, we
> > are moving from dynamic scripts to pre-generated static pages, and want
> to
> > maintain old links to outside.
>
> You can do this. Know though that the RewriteRule only works on the
> URL, and ignores the query string. You can use the query string in
> RewriteCond lines though.
>
> So you could use something like this:
>
> RewriteCond %{QUERY_STRING}   ^(.+)$
> RewriteRule  /a.php%1
>
> Basically what this rule does is chekc if the url matches a.php and if
> it does then it checks if the QUERY_STRING is at least on charachter
> long, capturing it in the process. If that is the case the URL is
> replaced with the captured query.
>
> Krist
>
>
> --
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> Bremgarten b. Bern, Switzerland
> --
> A: It reverses the normal flow of conversation.
> Q: What's wrong with top-posting?
> A: Top-posting.
> Q: What's the biggest scourge on plain text email discussions?
>
> -
> The official User-To-User support forum of the Apache HTTP Server Project.
> See http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: [EMAIL PROTECTED]
>   "   from the digest: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>