views:

29

answers:

1

I want to rewrite everything that uses this pattern...

/test/?TEXT=TRUE and allow it to be /test/TEXT AND /test/TEXT2, and so on.

+1  A: 

Yes you can. Create 2 rules:

RewriteRule ^/test/help$  /test/?help=true [L]
RewriteRule ^/test/(.*)$  /test/?random=$1
Ben Fransen
I already know the first rule. The second rule doesn't work at all. I want the first part ?random to be the new url test/"random"
Homework
No, because with the first rule you tell the server that whenever /test/help is called it should stop matching with other rules by the [L] (last) flag. The next rule will fetch all requests made to /test/whatever-is-provided. Via $_GET['random'] you can fetch the provided data.
Ben Fransen
Upd. what is your purpose then? I'm guessing you want to include a file somewhere.. which is now possible when using `$_GET['random']`
Ben Fransen
I don't want 50 lines of code in my htaccess for rewrites? I want to change the url to the first part, "random" since =$1 will be =true.
Homework
Random, that's exactly what's possible with `(.*)`??
Ben Fransen
And if i now, finally understand what you're trying to do. You can still do this? In your code create a new $_GET value based on $_GET['random']... Where do you need it for? Because it's a bit vague to me..
Ben Fransen
"random" is supposed to refer to a random function in my list... not the word literally... which is why I was puzzled. I have numerous $_GET values that I want to use.
Homework
RewriteRule ^test/(.*)$ /test/?$1=true [L] is what I'm trying to do! Get it?
Homework
Yes I get it, i think. You can manipulate your URL by setting `RewriteRule ^test/(.*)$ /test/?function=$1`
Ben Fransen