internal server error with a rewriterule

internal server error with a rewriterule

am 08.06.2007 20:34:29 von yawnmoth

Here's the rule:

RewriteEngine on
RewriteRule ^([^=?]+)?([^=]+)$ $1?param=$2

Any ideas?

The pattern shouldn't ever match what the URL is being rewritten to
because the pattern isn't supposed to contain any ='s whereas the
rewritten URL does...

Re: internal server error with a rewriterule

am 08.06.2007 21:31:35 von Jim Hayter

yawnmoth wrote:
> Here's the rule:
>
> RewriteEngine on
> RewriteRule ^([^=?]+)?([^=]+)$ $1?param=$2
>
> Any ideas?
>
> The pattern shouldn't ever match what the URL is being rewritten to
> because the pattern isn't supposed to contain any ='s whereas the
> rewritten URL does...
>

When the rewritten URL hits this Rewrite Rule it only looks at whatever
you put in $1. The "param=$2" part is in the QUERY_STRING, not the URL
examined by the RewriteRule.

Re: internal server error with a rewriterule

am 09.06.2007 08:37:20 von szr

Jim Hayter wrote:
> yawnmoth wrote:
> > Here's the rule:
> >
> > RewriteEngine on
> > RewriteRule ^([^=?]+)?([^=]+)$ $1?param=$2
> >
> > Any ideas?
> >
> > The pattern shouldn't ever match what the URL is being rewritten to
> > because the pattern isn't supposed to contain any ='s whereas the
> > rewritten URL does...
> >
>
> When the rewritten URL hits this Rewrite Rule it only looks at
> whatever you put in $1. The "param=$2" part is in the QUERY_STRING,
> not the URL examined by the RewriteRule.

It can match a query string if you ask it to:

(untested)

RewriteCond %{QUERY_STRING} ^([^=]+)$
RewriteRule ^([^=?]+)$ $1?param=%1


That should do what you want.

--
szr