Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need some help redirecting a url with particular parameter value to a new url. For example how can i redirect these two urls with id 123 and 345 to a new url?


  • http://testserver.xyz.com/abc/content/content.jsp?contentId=123
  • http://testserver.xyz.com/abc/content/content.jsp?contentId=345


  • https://newpage.silkroad.com/
share|improve this question
Have a look at this intro on mod_rewrite. – Alberto De Caro Oct 9 '12 at 12:47

Assuming you want a 301 (Moved Permanently) redirect, then put the following in the .htaccess file in your document root:

Options +FollowSymLinks        # Must be enabled if not already
RewriteEngine On
RewriteRule ^abc/content/content\.jsp\?contentId=(123|345)$ https://newpage.silkroad.com/ [R=301,L]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.