• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

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

mysql 搞代码 4年前 (2022-01-09) 13次浏览 已收录 0个评论

Apache伪静态

gaodaima.com

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$ 本文来源gaodai$ma#com搞$代*码网2company/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文件即可。

gaodaima.com


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:apache中访问不了伪静态页面的解决方法_MySQL
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址