Apache Server configuration support - Hiding php extensions

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > October 2006 > Hiding php extensions





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Hiding php extensions
Hermann.Richter@gmail.com

2006-10-20, 1:26 pm

I want to hide php extension from my public URLs with out renaming any
..php file.

I did this on my .htaccess file:

RewriteEngine On
RewriteRule ^([^\.\?]+)(\?.*)?$ $1.php

which works fine. Every request to a file withput extension will be
rewritten to the same file with the php extension.

But since I want to completely hide php, I want any request to a .php
file to get a 404 response, i.e. as if the file doesn't exist.

To accomplish that I added this to the htaccess file:
RedirectMatch 404 \.php$

But it didn't work because I get a 404 error for every thing, not only
for .php requests.

Does anyone knows what the problem could be??

Thanks in advance.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com