Forum Moderators: phranque

Message Too Old, No Replies

Testing one dynamic page by the variable

apache seems to be ignoring me

         

lorax

6:03 pm on Oct 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm trying to test for one particular page so I can redirect the requests for it to another page.

The old page would be like so:
product.php?cat=24

My current rule is:
RedirectMatch ^product\.php\?cat=24$

But it's not working...

jdMorgan

11:36 pm on Oct 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Query strings are not part of the URL; They are data attached to a URL, to be passed to the resource (e.g. script) at that URL. Therefore, mod_alias does not 'see' query strings.

Mod_rewrite can be used to test query strings using the RewriteCond %{QUERY_STRING} construct, but again, it requires this special step, as RewriteRule only looks at the URL, just like mod_alias redirects do.

See the Apache mod_rewrite docs, and plenty of examples in "query string rewriterule" posts in this forum.

Jim

lorax

12:27 pm on Oct 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks jdM. That piece of information is what I needed. I'm off to get the rest.