Anyone with strong skills in Apache redirects?

Kulendra

Member
Aug 20, 2006
107
1
0
43
Hi guys
Ive been working on a problem since today morning and havent been able to figure out an answer yet to this question. Basically there is a URL
www.example.com/index.php?option=com_seyret that needs to be redirected to
www.example.com/index.php?page=Media

I tried with whatever the Apache redirects I know but it simply doesnt seem to work. Below is what I have

Code:
RewriteCond %{query_string} option=com_seyret
RewriteRule /index\.php$ http://www.example.com/index.php?page=Media

Anyone any idea why this is? Im sure this is a very simple problem in the syntax.
 

Kulendra

Member
Aug 20, 2006
107
1
0
43
mod_alias cannot be used

Sorry but mod_alias cannot be used to match a query string (i.e. the portion after '?')
 

Kulendra

Member
Aug 20, 2006
107
1
0
43
danny
I want to solve the problem, but the two links you provided are of no help. If you check the problem you will see that I have to first match the query string to define the redirect. If you knew that mod_alias cannot be used to match the query string, I wonder why you mentioned it in the reply.
 

danny01

Member
Sep 15, 2007
251
2
0
Paradise/ Hell
oops sorry. Didn't realise you were tryin 2 redirect a query string to another query string...

sorry again.

try this instead.

Modifying the Query String

Change any single instance of val in the query string to other_val when accessing /path. Note that %1 and %2 are back-references to the matched part of the regular expression in the previous RewriteCond.

Code:
RewriteCond %{QUERY_STRING} ^(.*)val(.*)$
RewriteRule /path /path?%1other_val%2

http://wiki.apache.org/httpd/RewriteQueryString