Using .do extension as .php extension for all php files

How can I hide regular PHP filename extensions and use native extensions?

For example, using example.do

instead of example.php

.

I want files with a name extension to .do

be treated as PHP files so I can access the example.do

. How can i do this?

+3


source to share


2 answers


Add the following line to the file .htaccess

AddHandler application/x-httpd-php .do

      



This tells the server to treat all files ending in .do

like .php

.

+4


source


Another alternative is sethandler

.

According to Apache documentation , the difference is this:



If you prefer only the last dotted part of the filename to match against a specific piece of metadata, then don't use the Add * directives. For example, if you want the foo.html.cgi file to be processed as a CGI script but not bar.cgi.html, then instead of using AddHandler cgi-script.cgi use
<FilesMatch "[^.]+\.cgi$">
  SetHandler cgi-script
</FilesMatch></blockquote>

      

0


source







All Articles