Hi, I've seen in a webpage that we can hide the .php extension by over riding some settings in httpd.conf file like, DefaultType text/plain => DefaultType application/x-httpd-php see this url: http://php.net/manual/en/security.hiding.php so the server parses a web page which comes without an extension as a php page. The problem here is it doesn't works for me, what i did is i've changed the settings as above and created a file like test and within that i echoed some text. when i run the test page, the browsers shows like a text file. the test page content is, <?php echo "hio"; ?> can anyone tell me how to set these settings right?
on your php ini file, put expose_php to off there are many ways to hide extensions, best way would be by doing it in .htaccess
example in htaccess AddType application/x-httpd-php .htm .html for instance you can make your extension names .myfiles AddType application/x-httpd-php .myfiles
Hi, thanks for your replies, but am new to php,so i know only little about htaccess that we have a .htaccess and we've have to set all our configurations within that file. I tried it after your reply, like create a .htaccess file within that file i set rewrite engine on and tried for hidden redirect for testing purpose but actually when i run the page it shows some error. it seems like .htaccess file is not properly configured. can u tell me how to setup the .htaccess file and configure to hide extensions. am working in red hat linux platform, Thank you..
are you looking for a redirect or to hide the extension of the file and still process php? thats 2 separate things?
If you want to hide the .php part of a file called test.php you can do this, which doesn't require mod_rewrite. PUT this into a .htaccess file <FilesMatch "^test$"> < ForceType application/x-httpd-php > </FilesMatch> PHP: The file on your server will still be called test.php but you can call the file like this siteUrl.com/test Code (markup):
Hi friends, thanks for all your suggestions ,actually my question is hiding .php extension without using .htaccess. Is it possible?