Forum Moderators: phranque

Message Too Old, No Replies

redirectmatch problem

         

giannamanuela

3:58 pm on Sep 6, 2006 (gmt 0)

10+ Year Member



I have this rule in the htaccess file but it creates an error. It seems
> that the "&" returns the entire matched string.
> How can I get around that. Any ideas?
>
> This is the rule:
>
> redirectmatch category([0-9]+).*
> /catalog/index.php?target=categories&category_id=$1
>
> This is the error:
>
> You don't have permission to access
> /catalog/index.php?target=categoriescategory101.htmlcategory_id=101category_id
> =101category_id=101category_id=101category_id=101category_id=101category_id=10
> 1category_id=101category_id=101category_id=101category_id=101category_id=101ca
> tegory_id=101category_id=101category_id=101
> on this server.

jdMorgan

5:30 pm on Sep 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The redirect family of directives in mod_alias do not handle query strings attached to URLs; They are passed through unchanged.

To solve this problem, use mod_rewrite, and use a RewriteCond pattern to check and create a back-reference to %{QUERY_STRING} for use in the rewriterule, in much the same way as you tried to do for redirectmatch.

Jim