手机
当前位置:查字典教程网 >编程开发 >mysql数据库 >apache中访问不了伪静态页面的解决方法
apache中访问不了伪静态页面的解决方法
摘要:1、安装复制代码代码如下:./configure--prefix=/usr/local/apache2--enable-so--enable...

1、安装

复制代码 代码如下:

./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文件即可。

【apache中访问不了伪静态页面的解决方法】相关文章:

mysql出现Error performing load command的解决方法

asp.net 将图片上传到mysql数据库的方法

CMD下查询Mysql中文乱码的解决方法

mysql中迅速插入百万条测试数据的方法

MySQL 导入慢的解决方法

mysql 双向同步的键值冲突问题的解决方法分享

IIS 7.5通过web.config设置伪静态规则方法

mysql忘记密码的解决方法

mysql启动提示mysql.host 不存在,启动失败的解决方法

NaviCat连接时提示"不支持远程连接的MySql数据库"解决方法

精品推荐
分类导航