views:

20

answers:

1

I am trying to rewrite

tagged.php?flag=parameter&page=1

into

/parameter/?page=1

So I am using:

RewriteRule Hotties/?(.*) tagged.php?flag=parameter&page=$1

However the result I am getting is:

/parameter/?page=

Which is the "1". I am not sure what is missing. Clearly the issue is with the (.) and the "=" but I am not sure what is wrong. I also tried (.$) which did not fix it.

A: 

According to the documentation, you need to match against the URL path and the query string separately. If this is really your question,

I am trying to rewrite

tagged.php?flag=parameter&page=1

into

/parameter/?page=1

then you'd use

RewriteCond %{QUERY_STRING} flag=parameter&page=(\d+)
RewriteRule ^/tagged.php$ /parameter/?page=%1

but I suspect you actually want to go the other way around, in which case you'd use

RewriteCond %{QUERY_STRING} page=(\d+)
RewriteRule ^/parameter/$ /tagged.php?flag=parameter&page=%1

Not sure where the "Hotties" thing comes into it.

David Zaslavsky
That will not work. The appropriate syntax is $1. You're also not escaping the `?` in the query string. Your rule would also match `parameterpage=1`
Jason McCreary
Oh yeah, silly me, wrong regex engine. (I've been working with a bunch of different ones recently so I get them mixed up) I've edited.
David Zaslavsky
Yea, I just forgot to escape the ? that fixed it.
Crunchline