您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php设置伪静态问题

2024/4/6 4:11:50发布17次查看
在设置伪静态时一直不能成功(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配置文件里多麻烦,有改动还得重启服务。
用.htaccess也不行啊
.htaccess代码:
options  followsymlinks
rewriteengine on
rewriterule rewriterule aaa.html news.php
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
首页面 错误页面能够访问 访问http://www.lhb.com/aaa.html就是aaa.html的内容也不能实现伪静态
rewriteengine onrewriterule ^aaa\.html news.php [nc]


rewriteengine onrewriterule ^aaa\.html news.php [nc]


rewriteengine onrewriterule ^aaa\.html news.php [nc]


按照你这种设置,http://www.lhb.com/aaa.html也会报错:you don't have permission to access / on this server. 虽然不知道为啥,但把配置文件httpd-vhosts.conf里的options none选项去掉就可以实现伪静态了
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product