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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
"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 |
|
|||
|
"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 |
|
|||
|
"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 |
|
|||
|
"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 |
|
|||
|
"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 |
|
|||
|
"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 |