我是要生成的静态内容,也可以在该处链接数据库生成动态内容于此
复制代码 触发系统生成纯静态化页面 方法:页面添加缓存时间;手动触发 页面添加缓存时间 复制代码我是要生成的静态内容
ServerAdmin webmaster@dummy-host.example.com DocumentRoot "c:/Apache24/docs/dummy-host.example.com" ServerName dummy-host.example.com ServerAlias www.dummy-host.example.com ErrorLog "logs/dummy-host.example.com-error.log" CustomLog "logs/dummy-host.example.com-access.log" common #配置规则如下所示 RewriteEngine on RewriteRule ^/vidio/([0-9]*).html$ /vidio.php?id=$1 复制代码 RewriteEngine其他配置规则以后会再添加 现在你访问http://yourhost.com/vidio/12.html时,相当于访问了http://yourhost.com/vidio.php?id=12 问题:配置完上面的内容后,又存在以下问题?如果项目目录下存在该静态页面时,到底是访问我们的静态页面还是访问我们伪静态的文件呢? 经过测试我们发现,并不会访问静态页面,如果我们想访问我们的静态页面怎么办? 伪静态和静态页面冲突时解决办法: 复制代码 #完整的配置规则如下 RewriteEngine on #添加以下两项,!-d 和 !-f 分别表示 目录 和 文件 #当访问的伪静态和相应的静态目录和文件冲突时,访问静态页面 RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f RewriteRule ^/index/([0-9]*).html$ /index.php?id=$1 复制代码 如果你觉得本文对您有帮助,可以留言或点赞哦! >>留于文后 如果您发现文中存在错误,欢迎留言指出,提前感谢!