Blogger Information
Blog 2
fans 0
comment 0
visits 1917
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
安装学习工具
简单生活的博客
Original
650 people have browsed it

为了测试方便,在本地Windows下搭建了PHP平台,张自然使用了PhpStudy。安装简单,集成PHP、Apache和MySQL以及其他组件。张自然对服务器来说就是个菜鸟,这个方法对服务器应该也有作用!

设置URL重写实现伪静态,稍微麻烦一点,查找了一些文档,现记录在此:

第一步,点击任务栏托盘区的phpStudyAdmin图标,选择“配置文件”→“httpd-conf”,打开该文件,搜索“AllowOverride None”,改为“AllowOverride All” 。注:不止一处。经反复测试,本机PhpStudy版本的该Apache配置文件,此处有效:

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All

第二步,添加.htaccess文件至Apache配置目录。

内容:

RewriteEngine on

RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1

目录:D:\Program Files\phpStudy\Apache2\conf (蓝色部分修改为实际安装目录)

然后重启Apache服务即可。


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post