LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-30-2010, 01:46 PM   #1
palani79
LQ Newbie
 
Registered: Dec 2010
Posts: 2

Rep: Reputation: 0
Linux Apache Redirect match


I need to write a redirect match for this
http://mysite.com/ds/index.jsp?contl...shboard&id=008 http://www.google.com
http://mysite.com/ds/index.jsp?contl...shboard&id=025 http://www.yahoo.com.
I tried different options nothing is working ..can some one help

RedirectMatch 301 /ds/index\.jsp([a-z_\-=?&]+)(.*)$ http://www.google.com
 
Old 12-30-2010, 02:16 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,793

Rep: Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859
Better use mod_rewrite:
Code:
RewriteEngine on

RewriteCond %{QUERY_STRING} ^contl(.*)$
RewriteRule ds/index.jsp(.*) http://www.google.com? [R=301]
Regards
 
Old 12-31-2010, 12:40 AM   #3
palani79
LQ Newbie
 
Registered: Dec 2010
Posts: 2

Original Poster
Rep: Reputation: 0
It is not working..

I tried this

RewriteCond %{QUERY_STRING} ^contl(.*)$
RewriteRule ds/index.jsp(.*) http://www.google.com? [R=301]

also I am not sure what should be the second Rewritecond?


http://mysite.com/ds/index.jsp?dashboard&id=008 -->http://www.google.com
http://mysite.com/ds/index.jsp?dashboard&id=025 --->http://www.yahoo.com.
 
Old 12-31-2010, 05:04 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,793

Rep: Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859
You've changed contl with dashboard in the URI.
If you want to redirect based on the id number, you can try this:
Code:
RewriteEngine on

RewriteCond %{QUERY_STRING} ^dashboard([&]+)id=([0-9]+)
RewriteCond %2 ^008$
RewriteRule ds/index.jsp(.*) http://www.google.com? [R=301]
RewriteCond %{QUERY_STRING} ^dashboard([&]+)id=([0-9]+)
RewriteCond %2 ^025$
RewriteRule ds/index.jsp(.*) http://www.yahoo.com? [R=301]
Cheers
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirect https apache requests to folder not in apache root bax Linux - Enterprise 4 04-12-2010 02:16 PM
apache redirect mahmoud Linux - Newbie 3 01-13-2009 09:59 PM
how to use the sed w option to redirect pattern match to file nickleus Linux - General 11 04-18-2006 09:34 AM
svcadm: Pattern 'apache' doesn't match any instances xpucto Solaris / OpenSolaris 8 02-19-2006 08:30 AM
apache redirect? fibbi Linux - Software 7 01-30-2004 11:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration