another Mod Rewrite Question

another Mod Rewrite Question

am 20.12.2007 07:53:59 von Maria

I want to redirect anything that contains

..html?browse=maria

to the following:

/opendir/index.php?browse=maria

For example,

I want

http://www.logarithmos.com/aloha.html?browse=/hell1o1/hello2 /

to go to

http://www.logarithmos.com/opendir/index.php?browse=/hello1/ hello2/

How can I do it?

When I try

RewriteCond %{QUERY_STRING} ^browse=/(.*)$
RewriteRule ^logarithmos\.com/.*$ /opendir/index.php?browse=/%1 [L]

it does not work.

Thank you very much!

maria

Re: another Mod Rewrite Question

am 20.12.2007 12:33:27 von HansH

"maria" schreef in bericht
news:gv3km35r1bj20otg0tegc49n3t6ot2e5br@4ax.com...
>I want to redirect anything that contains
> .html?browse=maria
> to the following:
> /opendir/index.php?browse=maria
>
> For example,
> http://www.logarithmos.com/aloha.html?browse=/hell1o1/hello2 /
> to go to
> http://www.logarithmos.com/opendir/index.php?browse=/hello1/ hello2/
>
> How can I do it?
> When I try
> RewriteCond %{QUERY_STRING} ^browse=/(.*)$
> RewriteRule ^logarithmos\.com/.*$ /opendir/index.php?browse=/%1 [L]
>
Your rule never matches as it only handles '/aloha.html' part of the link.
Assuming browse will ALWAYS be the first query string element is wrong.
No need to backtick portions of the query string

Try -without \b on failure-
RewriteCond %{QUERY_STRING} \bbrowse=
RewriteRule \.html$ /opendir/index.php [L,QSA]

HansH

Re: another Mod Rewrite Question

am 20.12.2007 14:34:29 von Maria

On Thu, 20 Dec 2007 12:33:27 +0100, "HansH"
wrote:

>"maria" schreef in bericht
>news:gv3km35r1bj20otg0tegc49n3t6ot2e5br@4ax.com...
>>I want to redirect anything that contains
>> .html?browse=maria
>> to the following:
>> /opendir/index.php?browse=maria
>>
>> For example,
>> http://www.logarithmos.com/aloha.html?browse=/hell1o1/hello2 /
>> to go to
>> http://www.logarithmos.com/opendir/index.php?browse=/hello1/ hello2/
>>
>> How can I do it?
>> When I try
>> RewriteCond %{QUERY_STRING} ^browse=/(.*)$
>> RewriteRule ^logarithmos\.com/.*$ /opendir/index.php?browse=/%1 [L]
>>
>Your rule never matches as it only handles '/aloha.html' part of the link.
>Assuming browse will ALWAYS be the first query string element is wrong.
>No need to backtick portions of the query string
>
>Try -without \b on failure-
> RewriteCond %{QUERY_STRING} \bbrowse=
> RewriteRule \.html$ /opendir/index.php [L,QSA]
>
>HansH
>

HansH,

I tried this and it worked!

RewriteCond %{QUERY_STRING} ^browse=/(.*)$
RewriteRule ^(.*).html(.*)$ /opendir/index.php?browse=/%1 [L]

Thank you for your fesponse.

maria