New to apache having rewrite rule problem please help

After 3 solid days i have managed to get apache with mod_rewrite installed with php.

Not bad for a coldfusion / iis guy

However i am having problems getting a mod_rewrite rule to work

I know it is working because this simple rule processes no problem

RewriteRule ^foo.html bar.html [R,L]

however when i try to rewrite the folloing url

http://localhost/playhere.php?info=heli-tours.html

to output as

http://localhost/playhere/info/heli-tours.html

I have no luck page not found?

I have tried to following combinations with no success

RewriteRule ^playhere/(.*)/(.*)/$ playhere.php?$1=$2
RewriteRule /playhere/(.*)/(.*)/$ /playhere.php?$1=$2
RewriteRule playhere/(.*)/(.*)/$ /playhere.php?$1=$2

also do you need to restart apache after modifing the .htaccess file?

Any help with this issue would be of great assistance and be much appreciated

thank you in advance
mediatimebombAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arantiusCommented:
mediatimebomb,

What version of apache are you using?  Your problem is "greedy wildcards" and it cna be solved more directly in apache 2 which has stronger regex support.  In short, your first .* is matching everything because that's how wildcards work in regular expressions.

In apache 2, use (.*?) as a non-greedy operator instead of (.*).  In 1, you have to go a little backwards.  use: ([^/]*) .  This matches any number of characters that are not a slash.  Which is what you want =)
0
hernst42Commented:
Try this rewrite-Rule:

RewriteRule ^playhere/([^/]+)/(.*)$ playhere.php?$1=$2

This will rewrite
http://localhost/playhere/info/heli-tours.html
to
http://localhost/playhere.php?info=heli-tours.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mediatimebombAuthor Commented:
thanks for you help
0
arantiusCommented:
What ?! That's exactly what I said.  Except I said it first.  And explained why.
0
hernst42Commented:
I haven't read your comment while I was trying to solve that problem (needed 20 min to setup my apache and get mod_rewrite to work). My reg-ex does not rely on greedines or not.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.