{QUERY_STRING} & RewriteCond

This is a discussion on {QUERY_STRING} & RewriteCond within the Apache Web Server forums, part of the Web Server and Related Forums category; hi... how can I rewrite /folder/file.php?action=value into /folder/file.php/value ? I tried several things but ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-11-2005
Oliver Spiesshofer
 
Posts: n/a
Default {QUERY_STRING} & RewriteCond

hi...
how can I rewrite

/folder/file.php?action=value

into

/folder/file.php/value

?

I tried several things but never got to any result

all attempts would not get rid of the question mark...

such as

RewriteCond %{QUERY_STRING} ^(.*)?action$
RewriteRule ^(.*)$ /folder/file.php/value [R=301,L]

this would always append ?action=value at the end and create a loop.

any help appreciated.

Oliver

  #2 (permalink)  
Old 03-11-2005
HansH
 
Posts: n/a
Default Re: {QUERY_STRING} & RewriteCond

"Oliver Spiesshofer" <oliver@email.com> schreef in bericht
news:Xns961666845E577oliveremailcom@63.223.5.251.. .
> hi...
> how can I rewrite
> /folder/file.php?action=value
> into
> /folder/file.php/value
> I tried several things but never got to any result
> all attempts would not get rid of the question mark...
>
> such as
> RewriteCond %{QUERY_STRING} ^(.*)?action$
> RewriteRule ^(.*)$ /folder/file.php/value [R=301,L]
>
> this would always append ?action=value at the end and create a loop.

Try:
RewriteCond %{QUERY_STRING} ^(.*)action=(.*)
RewriteRule ^(.*)$ /folder/file.php/%2 [R=301,L]

Be aware of 'funny characters' in the value ...
.... they are not at all funny!

HansH



  #3 (permalink)  
Old 03-11-2005
Oliver Spiesshofer
 
Posts: n/a
Default Re: {QUERY_STRING} & RewriteCond

"HansH" <hans@niet.op.het.net> wrote in news:42317f27$0$28978
$e4fe514c@news.xs4all.nl:

> Try:
> RewriteCond %{QUERY_STRING} ^(.*)action=(.*)
> RewriteRule ^(.*)$ /folder/file.php/%2 [R=301,L]


I tried. this gives:

/main/article.php/20030811004609907/?story=20030811004609907

hmpf.

any idea?

Oliver

  #4 (permalink)  
Old 03-11-2005
HansH
 
Posts: n/a
Default Re: {QUERY_STRING} & RewriteCond

"Oliver Spiesshofer" <oliver@email.com> schreef in bericht
news:Xns9616B8926864Eoliveremailcom@63.223.5.251.. .
> "HansH" <hans@niet.op.het.net> wrote in news:42317f27$0$28978
> $e4fe514c@news.xs4all.nl:
> > Try:
> > RewriteCond %{QUERY_STRING} ^(.*)action=(.*)
> > RewriteRule ^(.*)$ /folder/file.php/%2 [R=301,L]

> I tried. this gives:
> /main/article.php/20030811004609907/?story=20030811004609907
> any idea?

/main/article.php is by no way the result of these very directives.
What are your exact directives and initial url (including the qs).
Anything rewrite logging active?

HansH


  #5 (permalink)  
Old 03-12-2005
Oliver Spiesshofer
 
Posts: n/a
Default Re: {QUERY_STRING} & RewriteCond

"HansH" <hans@niet.op.het.net> wrote in news:42320177$0$28975$e4fe514c@news.xs4all.nl:

> /main/article.php is by no way the result of these very directives.
> What are your exact directives and initial url (including the qs).
> Anything rewrite logging active?


Well the source url is

/main/article.php?story=20030811004609907

the intended result is

/main/article.php/20030811004609907

basically everything is correct except that the query string is re-appended somehow.

the exact http.conf instuction is:

RewriteCond %{QUERY_STRING} ^(.*)action=(.*)
RewriteRule ^(.*)$ /main/article.php/%2 [R=301,L]

I am not sure what you mean about rewrite logging.

thanks for the support!

Oliver

  #6 (permalink)  
Old 03-12-2005
HansH
 
Posts: n/a
Default Re: {QUERY_STRING} & RewriteCond

"Oliver Spiesshofer" <oliver@email.com> schreef in bericht
news:Xns96171913C550Eoliveremailcom@63.223.5.246.. .
> "HansH" <hans@niet.op.het.net> wrote in

news:42320177$0$28975$e4fe514c@news.xs4all.nl:
> > /main/article.php is by no way the result of these very directives.
> > What are your exact directives and initial url (including the qs).
> > Anything rewrite logging active?

> Well the source url is
> /main/article.php?story=20030811004609907
> the intended result is
> /main/article.php/20030811004609907
> basically everything is correct except that the query string is

re-appended somehow.
Toke me a moment to recognize this ...
.... re-appending is normal behaviour unless you make your own qs

Try
RewriteCond %{QUERY_STRING} ^(.*)action=(.*)
RewriteRule ^(.*)$ /main/article.php/%2? [R=301,L]
not sure the ? will be dropped from the location header.

> the exact http.conf instuction is:
> RewriteCond %{QUERY_STRING} ^(.*)action=(.*)
> RewriteRule ^(.*)$ /main/article.php/%2 [R=301,L]
>
> I am not sure what you mean about rewrite logging.

http://httpd.apache.org/docs/mod/mod...tml#RewriteLog


HansH


  #7 (permalink)  
Old 03-12-2005
Oliver Spiesshofer
 
Posts: n/a
Default Re: {QUERY_STRING} & RewriteCond

"HansH" <hans@niet.op.het.net> wrote in news:4232b850$0$28994
$e4fe514c@news.xs4all.nl:


> Try
> RewriteCond %{QUERY_STRING} ^(.*)action=(.*)
> RewriteRule ^(.*)$ /main/article.php/%2? [R=301,L]
> not sure the ? will be dropped from the location header.


this works!

thanks!

Oliver

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:25 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0