Dan
Dan

Reputation: 3358

htaccess redirecting one query string to another

I'd like to redirect http://domain.com/videos/?src=category1&video=video1

To http://domain.com/videos/watch?v=1

The obvious, just using a Redirect 301 /old /new doesn't work here. Here's my starting point and I can't seem to get this to redirect properly. This .htaccess file lives in the videos directory.

RewriteCond %{QUERY_STRING} ^src=category1&video=video1$ [NC]
RewriteRule /videos/watch\?v=1 [L,R=301]

Upvotes: 1

Views: 230

Answers (1)

Jon Lin
Jon Lin

Reputation: 143886

Try:

RewriteCond %{QUERY_STRING} ^src=category1&video=video1$ [NC]
RewriteRule ^$ /videos/watch?v=1 [L,R=301]

You were missing the rewrite rule's regex pattern.

Upvotes: 2

Related Questions