You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Edu Miralles <ed...@hotmail.com> on 2005/11/22 10:47:31 UTC

[users@httpd] mod_rewrite passing arguments in url


I need to
rewrite the url with the arguments between "-" onto a normal notation
to php. As the log says, the rewriting it's ok but after applicate the
rules, mod_rewrite splits the arguments, and at the end they are gone

  In this group I have found similar problems, but their workaround has
not worked

  example:
  titi-var1-value1-var2-value2 ---->
http://myserver/~user/test/titi.php?var1=value1&var2=value2

my .htaccess:

RewriteEngine On
RewriteRule ^(.*)(-.+)-([^-]+)-([^-&]*)([^-]*)\.html $1$2&$3=$4$5\.html
[N]
RewriteRule ^(.*)-([^-]+)-([^-]*)(.*)\.html
http://myserver/~user/test/$1.php?$2=$3$4 [L, QSA]

  rewrite.log:

86f9a8c/initial] (2) [per-dir /home/user/www/test/] rewrite
titi-var1-val1.html -> http://myserver/~user/test/titi.php?var1=val1
84.97.183.87 - - [22/Nov/2005:00:48:25 +0100]
[myserver/sid#858445c][rid#86f9a8c/initial] (3) split
uri=http://myserver/~user/test/titi.php?var1=val1 ->
uri=http://server/~user/test/titi.php, args=var1=val1
84.97.183.87 - - [22/Nov/2005:00:48:25 +0100]
[myserver/sid#858445c][rid#86f9a8c/initial] (3) reduce
http://myserver/~user/test/titi.php -> /~user/test/titi.php
84.97.183.87 - - [22/Nov/2005:00:48:25 +0100]
[myserver/sid#858445c][rid#86f9a8c/initial] (1) [per-dir
/home/user/www/test/] internal redirect with /~user/test/titi.php
[INTERNAL REDIRECT]

   and my acces.log

84.97.183.87.rev.net - - [22/Nov/2005:01:36:41 +0100] "GET
/~user/test/titi-var1-val1.html HTTP/1.1" 200 174 "-" "Mozilla/5.0
(X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Firefox/1.0.7
(Debian package 1.0.7-1)"

  Really I can not figure out the reason of this bizarre way of
working,
  thanks in advance,
  Eduard

_________________________________________________________________
Charla con tus amigos en lĂ­nea mediante MSN Messenger: 
http://messenger.latam.msn.com/


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite passing arguments in url

Posted by Joshua Slive <js...@gmail.com>.
On 11/22/05, Edu Miralles <ed...@hotmail.com> wrote:
>
>
> I need to
> rewrite the url with the arguments between "-" onto a normal notation
> to php. As the log says, the rewriting it's ok but after applicate the
> rules, mod_rewrite splits the arguments, and at the end they are gone
>
>   In this group I have found similar problems, but their workaround has
> not worked
>
>   example:
>   titi-var1-value1-var2-value2 ---->
> http://myserver/~user/test/titi.php?var1=value1&var2=value2
>
> my .htaccess:
>
> RewriteEngine On
> RewriteRule ^(.*)(-.+)-([^-]+)-([^-&]*)([^-]*)\.html $1$2&$3=$4$5\.html
> [N]
> RewriteRule ^(.*)-([^-]+)-([^-]*)(.*)\.html
> http://myserver/~user/test/$1.php?$2=$3$4 [L, QSA]

The RewriteLog looks perfectly normal to me.  Are you sure that you
are correctly checking for the query string in your php script?  It
might help to, at least temporarily, add an "R" to your options to get
an external redirect so you can see what apache is really looking at.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org