Home > php教程 > php手册 > 伪静态的实现 - 尼农小道

伪静态的实现 - 尼农小道

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-20 11:54:09
Original
1891 people have browsed it

伪静态的实现

简介

主要使用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文件

    浏览器:

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template