PHP项目部署-开启rewrite(伪静态)
2017-11-16 17:57
295 查看
TIPS:作者所用环境为2.4.25(Unix),不同版本配置应该会有所差异。
1、httpd.conf配置。#LoadModule rewrite_module modules/mod_rewrite.so 去掉#
TIPS:开启mod_rewrite即可实现Apache的伪静态功能。
2、httpd.vhosts.conf配置。
<VirtualHost *:80> ServerName www.xxx.com DocumentRoot /webdata/xxx <Directory "/webdata/xxx/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All </Directory> </VirtualHost>
一定要配置为:AllowOverride All
此时,我的PHP项目已经开启了rewrite模块,可以使用PHP框架路由模式来进行其指定的路由访问。
3、隐藏index.php入口文件:
在项目入口文件index.php的同级目录配置.htaccess。内容如下:
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f #RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1] </IfModule>
此时已完成PHP项目部署。
相关文章推荐
- 关于在linux下部署php项目
- Windows+Apache+PHP(5.6或者7.0)+MySQL项目部署各种坑的解决
- tomcat8下部署php项目
- 部署PHP项目应该注意的几点
- 【PHP项目部署二】Mysql环境配置
- ecplisePHP Studio 2008 + WampServer部署PHP项目
- 腾讯云服务器的配置与部署(一):云服务器的连接、项目(php与phpMyAdmin)的部署
- ExtJs项目部署到IIS开启GZIP支持遇到的问题
- 关于PHP伪静态Rewrite设置
- PHP:linux下如何部署php项目(一)
- 在iis中部署php项目,访问时写入错误
- Windows+Apache+PHP(5.6或者7.0)+MySQL项目部署各种坑的解决
- 基于Jenkins 实现php项目的自动化测试、自动打包和自动部署
- Ubuntu 下apache2开启rewrite隐藏index.php
- 代码查看php是否已开启rewrite功能模块
- php项目远程部署 wampserver上遇到问题
- 如何把php项目部署到阿里云服务器window server2012__含公网ip访问时jquery/ajax失效解决办法
- mac php yii2 项目 环境部署
- PHP:linux下如何部署php项目(二)
- PHP开发入门-Apache开启伪静态