版权声明:独学而无友,则孤陋寡闻。q群582951247 https://blog.csdn.net/mp624183768/article/details/85367618
这是测试环境
修改apach的目录下
F:\installIng\dev\wampserver\bin\apache\apache2.4.35\conf\httpd.conf
文件
AllowOverride all
修改此文件的作用 是为了改了重定向文件后 服务器不会重启 这样在测试环境下操作就很方便
在网站主目录下新建文件.htaccess
如何新建?
直接创建点开头的文件是创建不成功的
可以通过cmd命令 数字1>.htaccess 来创建该文件
1>.htaccess
编辑规则把所有的html 重定向到php
RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php
保存后测试
访问
http://127.0.0.1/indexaa.html
没有这个indexaa.php也不打紧 因为会报错误
Not Found
The requested URL /indexaa.php was not found on this server.
Apache/2.4.35 (Win64) PHP/5.6.38 Server at 127.0.0.1 Port 80
so 这样就创建成功了
重定向的逻辑没学过之间觉得复杂的一笔,学完以后感觉还挺简单的
有趣 木马~