Forum Moderators: phranque

Message Too Old, No Replies

redirectMatch in mod_alias

         

manuelsechi

8:15 am on Oct 12, 2005 (gmt 0)

10+ Year Member



hi all
i need to catch params in querystring, can i do something like thin using mod_alias?

RedirectMatch 301 /mypage.php?par1=(.*?)&par2=(.*?) [anotherserver.com...]

thanx all

jdMorgan

2:57 pm on Oct 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, mod_alias can't access the query string.

Be aware that a query string is not part of a URL; It is data appended to the URL to be passed to the resource *at* that URL. For this reason, many Apache directives that test URLs cannot 'see' the query string.

You can use mod_rewrite, and access the query string with RewriteCond. The basic syntax would be:


RewriteCond %{QUERY_STRING} ^param_name=value
RewriteRule ^requested_local_URL-path$ http://example.com/new_URL-path [R=301,L]

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim