http://cn2.php.net/manual/zh/security.hiding.php# 使 PHP 代码看上去像 HTML 页面
AddType application/x-httpd-php .htm .html

解决方案 »

  1.   

    楼上的办法不推荐使用,增加服务器负担
    查看详细的Apache rewrite文档,用rewrite规则隐藏PHP扩展名
      

  2.   

    谢谢各位的解达,如果
    http://localhost/file/m.php/86/273X
    http://localhost/file/m/86/273X.php
    这多个参数的应该怎么去写呢?我写这个成功了,localhost/001.htm
    RewriteEngine   on
    RewriteBase     /
    RewriteRule     (.+)\.htm$ show.php?id=$1 [L]但是这样就不行,localhost/001.php
    RewriteEngine   on
    RewriteBase     /
    RewriteRule     (.+)\.php$ show.php?id=$1 [L]郁闷死了...
      

  3.   

    http://localhost/file/m.php/86/273X
    http://localhost/file/m/86/273X.phpRewriteEngine on
    RewriteBase /
    RewriteRule (.+)\.htm$ show.php?id=$1 [L]
    这个应该怎么写呢?
      

  4.   

    似乎这样可以隐藏
    httpd.conf
    -------------
    # ...
    # Minimize 'Server' header information
    ServerTokens Prod
    # Disable server signature on server generated pages
    ServerSignature Off
    # ...
    # Set default file type to PHP
    DefaultType application/x-httpd-php
    # ...php.ini
    ------------
    ; ...
    expose_php = Off
    ; ...然后看起来就像这样
    http://my.server.com/forums/post?forumid=15
      

  5.   

    可以用.htaccess的rewrite来实现。
      

  6.   

    http://localhost/file/m.php/86/273X
    http://localhost/file/m/86/273X.php
    我只想实践这个
    RewriteEngine on
    RewriteBase /
    RewriteRule ????????????
    那么这个正则应该怎么写呢?
      

  7.   

    # 使 PHP 代码看上去像 ASP 页面
    AddType application/x-httpd-php .asp
      

  8.   

    解析成什么都行,但千万不要解析成html htm这种,因为这样所有的静态页面都要用PHP程序解释一遍,加重服务器负载
      

  9.   

    不用那么复杂吧,直接在.htaccess里加上rewriteengine on 就可以了
    例子: http://vietnam.cvmachine.com/bcenter/register.simple
      

  10.   

    如果不想增加服务器负担的话,最好不用rewrite , 它始终会增加额外的开支。楼上
    DefaultType application/x-httpd-php
    expose_php = Off

    AddType application/x-httpd-php .asp
    都是种不错的方法。如果用rewrite 应该这样:#localhost/001.php
    RewriteEngine   on
    RewriteBase     /
    RewriteCond %{REQUEST_URI} !^(.*/)?show\.php$ [NC]
    RewriteRule     (.+)\.php$ show.php?id=$1 [L]
    不然会造成死循环
      

  11.   


    似乎这样可以隐藏
    httpd.conf
    -------------
    # ...
    # Minimize 'Server' header information
    ServerTokens Prod
    # Disable server signature on server generated pages
    ServerSignature Off
    # ...
    # Set default file type to PHP
    DefaultType application/x-httpd-php
    # ...php.ini
    ------------
    ; ...
    expose_php = Off
    ; ...然后看起来就像这样
    http://my.server.com/forums/post?forumid=15
    -------------------------------------
    依照这个方法,我的没有实现,还有别的需要修改吗?
    提示文件未找到,该怎么测试?