0

I want my shared web server to process ".ncs" files just like ".php" files. I know this can be easily done by adding an entry in Apache Handler. Ref: http://php.net/manual/en/security.hiding.php

But as I have mentioned that I am using shared hosting, any changes made by me on Apache Handler will not work. Those lists are just for reference. I opened a ticket in my website provider's support panel and they told me that I should use .htaccess file for that. But I am unable to understand that how I may use .htaccess file to process .ncs files just like .php files.

Hamees A. Khan
  • 136
  • 1
  • 10
  • 2
    Possible duplicate of [How to change the PHP file extension using .htaccess file on GoDaddy Linux Hosting?](https://stackoverflow.com/questions/7897353/how-to-change-the-php-file-extension-using-htaccess-file-on-godaddy-linux-hosti) – cteski Jul 24 '17 at 20:13
  • My two cents would be *not* use .htaccess if at all possible. The need to turn on Allow Override causes overhead of scanning filesystem and is not desirable. – ficuscr Jul 24 '17 at 20:35

1 Answers1

2

You need to use a AddType handler on the htaccess of the root of your server:

AddType application/x-httpd-php .ncs

BUT if you're running PHP as CGI, you need to use AddHandler too:

AddType application/x-httpd-php .ncs
AddHandler application/x-httpd-php .ncs
LordNeo
  • 1,195
  • 1
  • 8
  • 21
  • This is what my .htaccess file of root directory has: SetOutputFilter DEFLATE BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary Header append Vary User-Agent env=!dont-vary **Where to add your suggested code snippet?** – Hamees A. Khan Jul 25 '17 at 08:06
  • At the complete begining of the file. – LordNeo Jul 25 '17 at 12:50
  • I have tried it. But still nothing. The PHP server is still not evaluating statements of the pinfo.ncs file. – Hamees A. Khan Jul 25 '17 at 16:12
  • try with x-httpd-php5, sounds weird but the server could be configured differently. – LordNeo Jul 25 '17 at 16:16