Home > Backend Development > PHP Tutorial > 动态网页地址如何变成静态

动态网页地址如何变成静态

WBOY
Release: 2016-06-23 13:59:50
Original
1798 people have browsed it

做个网站 是基于php动态的   但是点开链接都是 index.php?id=12 之类的 能不能用伪静态这个变成index_xx.html 谢谢


回复讨论(解决方案)

当然是可以的咯

在index.php文件夹内起一个.htaccess文件
然后输入

RewriteEngine on
RewriteRule ^index_(.*)\.html  index.php?id=$1 [NC]

就可以访问 index_12.html 显示 index.php?id=12的内容

这些都是http服务器实现的,URL rewrite,不同的有不同的配置方式

你可以在apache/nginx等的文档中查询。

ok多谢各位

source:php.cn
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template