.htaccess passing through non existent extension

I am having one of those developer moments where I am not seeing the obvious.

I have an .htaccess file that does two things

Either sends requests of the type

http://domain/service/blah/blah/blah => service.php?args=$1
Failing that everything is sent to index.php

All works - except for one small thing - the args passed to service .php starts with .php so using the above example service.php receives

Open in new window

Instead of

Open in new window

The rewrite rule for service is as follows  
RewriteRule ^service(.*)$ service.php?args=$1 [L,NC,QSA]

Open in new window

What am I missing? Why the .php prefix?
LVL 66
Julian HansenAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Dave BaldwinFixer of ProblemsCommented:
I don't know but I see examples written these two ways.
RewriteRule ^service(.*)$ /service.php?args=$1 [L,NC,QSA]
RewriteRule ^service(.*)$ http://service.php?args=$1 [L,NC,QSA]

Open in new window

Julian HansenAuthor Commented:
I think I figured it out - silly mistake on my part

I was trying to match a string that was the same as the filename it was redirecting to

^service(.*)$ service.php

Changed it to
^svc(.*)$ service.php

And all sorted.

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
Julian HansenAuthor Commented:
Thanks Dave for the response.

The /service option won't work on my side - I am using a RewriteBase directive so all my rules are relative to that - but appreciate the feedback.
Dave BaldwinFixer of ProblemsCommented:
Glad you got it figured out anyway.
Julian HansenAuthor Commented:
Found the solution on my own
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.