1

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]
2
  • 1
    Can you share your attempted rule? Commented Oct 25, 2013 at 19:14
  • I added some code that i've been working with. Commented Oct 25, 2013 at 19:17

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

5 Comments

ah makes sense, still not working though - i'm not getting any errors. It's just not doing anything.
@Dan is the htaccess file in your document root? or in a directory called "video"?
It's in the video directory. Ah so must be a path issue?
@Dan yeah, the place the htaccess file is at determines what URI gets put through the rules, so we need to remove video from the pattern because that bit is stripped off.
Actually the RewriteRule should be RewriteRule ^(.*)$ /videos/watch?v=1 [R=301,L] or it will not work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.