apache中访问不了伪静态页面的解决方法
2023-06-13 09:14:45 时间
1、安装
./configure--prefix=/usr/local/apache2--enable-so--enable-rewrite--enable-ssl
这时apache已经拥有的伪静态功能了,称为内建伪静态。
2、如果安装的时候没有 --enable-rewrite 这个参数,那么:
到“LoadModule”区域,在最后一行加入“LoadModulerewrite_modulemodules/mod_rewrite.so”(必选独占一行),然后重启apache服务器即可。
3、让apache服务器支持.htaccess
vim/usr/local/apache2/conf/extra/http-vhosts
AllowOverrideNone
改为
AllowOverrideAll
就可以了。
但是需要在网站文件中加入一个htaccess文件。才可以综合支持伪静态功能。(在网站文件目录下)
vim.htaccess
RewriteEngineOn
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文件即可。
相关文章
- Nginx 和 Apache 安装[通俗易懂]
- Apache URL重定向
- linux apache安装与配置_Apache配置
- 开源经验分享 | 如何从一名小白成为Apache Hudi Contributor
- Apache Kafka入门级教程
- 编译Apache服务部署静态网站
- apache 简介、资源网站、目录结构
- Apache 董事面对面 | 如何在开源社群构建影响力?
- 监控使用说明 | 如何使用 Apache IoTDB 分布式系统监控模块
- Apache二级目录部署react/vue教程
- Apache伪静态与IIS伪静态有什么差别?
- IIS&Apache 攻击记录分析篇
- SQL开发知识:使用 Apache Superset 可视化 ClickHouse 数据的方法
- Apache ActiveMQ任意文件写入漏洞(CVE-2016-3088)复现
- 利用Apache commons exec 实现指定应用打开对应文件详解编程语言
- Linux 下 Apache 服务器安装指南(linux安装apache)
- 漏洞预警:基于RedHat发行的Apache Tomcat本地提权漏洞
- 实现Linux搭建Apache服务器的简单指南(linux装apache)
- apache、apache-tomcat-6.0.39下载包
- Linux下重启Apache简易指令.(linux重启apache命令)
- Win2000+Apache+MySql+PHP4+PERL安装使用小结
- linux下安装apache与php;Apache+PHP+MySQL配置攻略
- Apache配置详解(最好的APACHE配置教程)
- apache中通过mod_rewrite实现伪静态页面的方法