简体   繁体   中英

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

How can I hide the normal PHP filename extensions and use my own extensions?

For example, using example.do instead of example.php .

I want files with the the .do filename extension to be treated as PHP files, so that I can access example.do . How can I do this?

Add the following line to your .htaccess file

AddHandler application/x-httpd-php .do

This tells the server to process all files ending with .do as .php .

Another alternative is sethandler .

According to the Apache documentation , the difference is:

If you would prefer only the last dot-separated part of the filename to be mapped to a particular piece of meta-data, then do not use the Add* directives. For example, if you wish to have the file foo.html.cgi processed as a CGI script, but not the file bar.cgi.html, then instead of using AddHandler cgi-script .cgi, use
<FilesMatch "[^.]+\.cgi$">
  SetHandler cgi-script
</FilesMatch></blockquote>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM