kumarjcet
asked on
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"
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"
ASKER
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...
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]
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
http://www.spencerdrager.com/2010/02/07/hide-php-extension-in-url-using-htaccess/
ASKER
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?
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?
please upgrade to 2.2.21, 1.3.34 has very security leaks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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 ... ;)