在设置伪静态时一直不能成功(rewrite组件已经打开)httpd-vhosts.conf配置是
documentroot "e:/daima/htdocs/virtual"
servername www.lhb.com
#directory节点指定该目录下的文件,图片的访问权限
#设置虚拟主机的错误页面,欢迎页面
order allow,deny
allow from all
#是否列出文件目录(none不显示indexes显示目录)
options indexes
#设置错误页面
errordocument 404 /error.html
#设置首页面
directoryindex index.html
#allowoverride all
#配置rewrite
rewriteengine on
rewriterule aaa.html news.php
去掉rewriteengine on
rewriterule aaa.html news.php错误页面,首页面均能正确显示,带入那2行代码,在浏览器输入www.lhb.com/aaa.html则报错:you don't have permission to access / on this server.
用的Apache?为什么不用.htaccess文件呢?
写apache配置文件里多麻烦,有改动还得重启服务。
用的Apache?为什么不用.htaccess文件呢?
写apache配置文件里多麻烦,有改动还得重启服务。
<IfModule mod_rewrite.c>RewriteEngine OnRewriteRule ^aaa\.html news.php [NC]</IfModule>
<IfModule mod_rewrite.c>RewriteEngine OnRewriteRule ^aaa\.html news.php [NC]</IfModule>
<IfModule mod_rewrite.c>RewriteEngine OnRewriteRule ^aaa\.html news.php [NC]</IfModule>
虽然不知道为啥,但把配置文件httpd-vhosts.conf里的Options None选项去掉就可以实现伪静态了
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号