Jump to content

[SOLVED] Finding the question mark


Jesper

Recommended Posts

Hey guys,

 

For my latest project, I need to find the something in an expression. The expression is:

gamenieuws/([0-9]+)/?.*

The problem is that at the end of the expression there can be another GET variable, so it would end with something like ?&var=val. I don't want to replace this with the regexp. I've managed so far to find the question mark, but it replaces the string until 1 char before the ?, instead of it replaces it until the ?.

 

My regexp is now:

gamenieuws/([0-9]+)/?(.[^\?])* ?item=$1

 

 

The problem

It might be hard to understand, and I find it hard to explain as well. Anyways, this is what I want:

Find gamenieuws/([0-9]+)/.*, but then I want to pass on the get variables as well. For example, I want

gamenieuws/123/Lorem-Ipsum-Dolor-Sit-Amet.html?&val1=25&val2=4
to become
?item=123&val1=25&val2=4
.

 

Could anyone help me with how to do this, because I've been trying for very long and I have no idea :P.

 

 

Thanks in advance,

 

Jesper

Link to comment
Share on other sites

Yeah, but how would I get the GET data that's after that? So how would I retrieve the val1 and val2 in gamenieuws/123/Lorem-Ipsum-Dolor-Sit-Amet.html?&val1=25&val2=4, as this data has to be passed on as well.

Link to comment
Share on other sites

Ah, kk, thanks :). I've found the problem now, and that is that GET variables are just not part of the replacing when using RewriteRule. I'm using %{QUERY_STRING} for the GET variables now, as I should've in the first place :).

 

Thanks for the help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.