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"
kumarjcetAsked:
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 ... ;)
0
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...
0
xtermCommented:
I fixed your rule, here you go:
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/$0.php -f
RewriteRule ^(.*)$      $1.php [L]

Open in new window

0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

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

Open in new window

http://www.spencerdrager.com/2010/02/07/hide-php-extension-in-url-using-htaccess/
0
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

code.

Is there any way to implement url

rewriting for Apache server version 1.3.34?
0
abolinhasCommented:
please upgrade to 2.2.21, 1.3.34 has very security leaks
0
xtermCommented:
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.
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
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
PHP

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.