您的位置:首页 > 运维架构 > Apache

centos7下配置apache伪静态页

2017-12-13 16:17 387 查看
1、在etc/httpd/conf/httpd.conf下找到Include conf.modules.d/*.conf,在这句话下添加LoadModule
rewrite_module modules/mod_rewrite.so;

2、在站点配置文件中添加以下配置:

     <Directory /var/www/站点目录>

           AllowOverride all

     </Directory>

3、在站点根目录下添加.htaccess文件,文件内容:

     <IfModule rewrite_module>

             RewriteEngine On

             RewriteRule  html/test([0-9]+).html$ html/test.php?Id=$1

      </IfModule>

4、重启httpd服务,systemctl restart httpd。

(说明:RewriteRule 
html/test([0-9]+).html$ html/test.php?Id=$1中,html是你要设置静态页的目录,test.php是要变成静态页的页面)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  centos apache