Czar
Czar

Reputation: 366

Rewrite rule for apache htaccess that checks for existence of certain GET params

I just can't find a solution to this...

I have several dynamic page links that look like http://DOMAIN/PAGENAME?&param=a/param2=b&tx_ttnews[tt_news]=114&param3=c

No I want to have a rewrite for certain "tx_ttnews[tt_news]" values, i.e. if it exists (or certain other numbers) I want to redirect to a completly different URL.

I have just a small set, so basically I need a rule "Exists A > redirect to G", like

tx_ttnews[tt_news]=114 >> domain.com/asd.html tx_ttnews[tt_news]=93 >> otherdomain.org/ljasd.php

There is a mapping list, I could input lines for each item. I just don't know the right code....

Does anyone have a clue?

Upvotes: 0

Views: 165

Answers (1)

Czar
Czar

Reputation: 366

In case anyone is interested in the solution I found:

RewriteCond %{QUERY_STRING} (tx_ttnews(.*)tt_news(.*)=114)
RewriteRule (.*) http://www.domain.com/news/2010/07/my-new-news-item/? [L,R=301]

We ended up to have several rewrite rules for all affected IDs (14 in this sample). As each ID now corresponds to a certain URL in a different system, we had to write manual rewrites. Not pretty, but worked.

Upvotes: 1

Related Questions