How to hide php extension using .htaccess in shared server

I have used the below code

RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*[^/])/?$
RewriteCond %{DOCUMENT_ROOT}%1.php -f
RewriteRule .+ %1.php [QSA,L]

still my i am not able to call the file without its extension ".php"
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.

Garry GlendownConsulting and Network/Security SpecialistCommented:
Does your rewrite engine work at all? Did you permit changing this in .htaccess in the global config?
Hope you don't mind me asking, why hide it at all? If you don't want to divulge the info that you are running PHP for security reasons - security by obscurity doesn't work ... ;)
kumarjcetAuthor Commented:
yeah my rewrite engine is working when i try to  rewrite my website folders

RewriteRule ^admin/(.*) administrator/$1

this is working , when i hit admin... its mapping to administrator...

But in file scenario, it is not working... i wonder why it is not working...
I fixed your rule, here you go:
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/$0.php -f
RewriteRule ^(.*)$      $1.php [L]

Open in new window

The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

Open in new window
kumarjcetAuthor Commented:
Its not working.But i found the issue.

Apache server version 1.3.34 is the culprit.

Its not understanding the regex rewrite


Is there any way to implement url

rewriting for Apache server version 1.3.34?
please upgrade to 2.2.21, 1.3.34 has very security leaks
Normally I'm against the mentality of "upgrade" for every little thing, but 1.3.x is officially deprecated.   I don't know if your version can rewrite, but I know simply going to 2.2.x would be far easier than trying to find out.

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
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

From novice to tech pro — start learning today.