您好,欢迎访问一九零五行业门户网

apache中访问不了伪静态页面的解决方法_MySQL

apache伪静态
bitscn.com1、安装
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-ssl
这时apache已经拥有的伪静态功能了,称为内建伪静态。
2、如果安装的时候没有  --enable-rewrite  这个参数,那么:
到“loadmodule” 区域,在最后一行加入“loadmodule rewrite_module modules/mod_rewrite.so”(必选独占一行),然后重启apache服务器即可。
3、让apache服务器支持.htaccess
vim /usr/local/apache2/conf/extra/http-vhosts
options followsymlinks
allowoverride none
改为
options followsymlinks
allowoverride all
就可以了。
但是需要在网站文件中加入一个htaccess文件。才可以综合支持伪静态功能。(在网站文件目录下)
vim .htaccess
rewriteengine on
rewritebase /
# rewrite规则
rewriterule ^index/.htm$ index/.php
rewriterule ^jobs/jobs-show-([0-9]+)/.htm$ jobs/jobs-show/.php/?id=$1
rewriterule ^company/company-show-([0-9]+)/.htm$ company/company-show/.php/?id=$1
rewriterule ^resume/resume-show-([0-9]+)/.htm$ resume/resume-show/.php/?id=$1
rewriterule ^news/news-list-([0-9]+)-([0-9]+)/.htm$ news/news-list/.php/?id=$1&page=$2
rewriterule ^news/news-show-([0-9]+)/.htm$ news/news-show/.php/?id=$1
rewriterule ^explain/explain-show-([0-9]+)/.htm$ explain/explain-show/.php/?id=$1
rewriterule ^notice/notice-list-([0-9]+)-([0-9]+)/.htm$ notice/notice-list/.php/?id=$1&page=$2
rewriterule ^notice/notice-show-([0-9]+)/.htm$ notice/notice-show/.php/?id=$1
伪静态报错:
主站好用,但是链接不好用。链接是一个静态页面。以.html结尾的,所以我判断,就是为静态页面没生效,所以就添加.htaccess文件即可。
bitscn.com
其它类似信息

推荐信息