zoukankan      html  css  js  c++  java
  • 伪静态的实现

    伪静态的实现

    简介

    主要使用Apache提供的一个rewrite模块来实现,可以实现URL地址的重写

     

    使用

    1. 开启配置

    2. 更改虚拟主机里面的配置

    3. 在网站根目录建立一个.htaccess文件

       

      案例1

      实现将动态URL地址转换成一个静态的HTML地址

       

      http://local.order.com/index.html ----》Apache服务器 (rewrite重写----》index.php文件)----》返回给浏览器

      RewriteEngine On #开启rewrite功能

      RewriteRule index.html index.php # 将用户请求的index.html 重定向到 index.php文件

       

      效果:

      index.php文件

      浏览器

       

      案例2

      在rewrite模块里面使用正则

      效果:

      goods.php文件

      浏览器:

  • 相关阅读:
    hdoj:2075
    hdoj:2072
    hdoj:2071
    hdoj:2070
    hdoj:2069
    test001
    hdoj:2067
    hdoj:2061
    hdoj:2058
    hdoj:2057
  • 原文地址:https://www.cnblogs.com/nyxd/p/5369829.html
Copyright © 2011-2022 走看看