php伪静态怎么弄啊,有谁会具体一些,谢谢

解决方案 »

  1.   

    假说我我想把 news/index.php 改成news/index.html
      

  2.   

    <IfModule mod_rewrite.c>
    RewriteEngine On
     RewriteRule ^index.html$ index.php
     
    </IfModule>
     
    保存名为.htaccess的文件放根目录localhost/index.htm=ocalhost/index.php
      

  3.   

    apache <Directory />
     ...
        AllowOverride ALL
    ...
    </Directory>
      

  4.   

    fwrite($old,$new) 生成静态页面
      

  5.   

    应该是修改APACHE下HTTP。CONF里的rewrite模块,具体怎么改,应该谷歌上有相关介绍的!
      

  6.   


    这个是apache的URL重写nginx也基本上差不多
      

  7.   

    如果楼主只想实现.htm当php文件处理,不需要用rewrite重写!如果是apache服务器,找到:
    AddType application/x-httpd-php .php
    在这后面加一个 .htm就可以了,像这样:
    AddType application/x-httpd-php .php .htm如果是nginx服务器
    在nginx.conf里找到
    location ~ .*\.(php|php5)?$
    改成
    location ~ .*\.(php|php5|htm)?$
    index.htm服务器会当php解析的!如果你要保留服务器文件名为index.php,当路径又要是index.htm,那就得用重写了!
    apache的配置方法:
    http://hi.baidu.com/tianliao1988/blog/item/a4ae32cea1d01e35f8dc61d0.htmlnginx的配置示例:location ~ .*\.(htm)?$
    {
            root /var/www/html/news;
            rewrite /(.*\.php?) /$1 break;
            include fastcgi.conf;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
    }
      

  8.   

    我想把所有以.php结尾的换成.html怎么写啊